From patchwork Sun Apr 16 03:03:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212681 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06895C77B70 for ; Sun, 16 Apr 2023 03:03:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230103AbjDPDDq (ORCPT ); Sat, 15 Apr 2023 23:03:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230046AbjDPDDf (ORCPT ); Sat, 15 Apr 2023 23:03:35 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28C2E2711 for ; Sat, 15 Apr 2023 20:03:31 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-2efbab47633so378593f8f.2 for ; Sat, 15 Apr 2023 20:03:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614209; x=1684206209; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=DxQBscBC/g8H1L8ETVCqABnKtnxmxuhj/69d0QIq4fA=; b=Dqj/IiWeaHmTvcedswG35N2XLHlXsDRA/VRnsdZeGIxTpsVK58yX6rnuUO/k4bOigy BtGbOP38s2fwRUmt06JgjdH9IVqoLpwZgIT+s+QBy123yhe3RUYiTD9jLpjc5WgkNQW8 19QcVCeFf4evbJRmUmSZElYtTrbbbDGHV2zosgS/bT/y0zeWXwQEoT14fNqOomgXWFZC DpiQgV2bXTrZ7D/W2veTl8Jq+t9t5XkBmSvWLcj4+yR+g58lXUViMfmEds6iUoMjpUOh yWQv6cJ1Y+Kxp6rGP34X24/sxV82y4baBwQWvZkQDPEO7c8OgK2sZxTKyevbUcb7rp0Q f2EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614209; x=1684206209; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DxQBscBC/g8H1L8ETVCqABnKtnxmxuhj/69d0QIq4fA=; b=PEycovQWEfR6mAyEC507fcYT0S5+HCQuCKj0sQR2ZSh771i2J13IGrRj29VRTTyBlY 5RzkX1NvIc7v4LNVMZeZHWWF8BRO0gb0643LwfaqxzfTED4/c7W1ukba4UFaP0UKerWJ 6DjdsdEAzXV0OZbMYBquLRVKDs01no7kXwMZ28yHrcgq9AByf9BmH9+8DbzeF6/ywQzl acppIkdYrn1zGqnbdySVmtT8IOxl9whHEcRLoX6NfT0XTocEIiFC2uad1q8vkRWtIWXD Ba/gp54po2YMdXmQXJJbX3iCW0as6MTQr+joqfVSVRM1prO3iKhpc+rG9m4CQ1NvBVMN i+iw== X-Gm-Message-State: AAQBX9dzGRQQre8cTtMuN71z0obF24yg0ZySOPBj8Q4qYY2wODVvNmmv F6N0W9N3XhXbyVRDPZ+fxzgHkQZhJL0= X-Google-Smtp-Source: AKy350abtpFjjSHCVDeF61tDlDiPZr9wKZX6YdTA9Efw/Pkvm/1EXfm/txX7djNTX6+nx5ZKCAKZIw== X-Received: by 2002:adf:db4c:0:b0:2f6:6f0c:a2ba with SMTP id f12-20020adfdb4c000000b002f66f0ca2bamr2737896wrj.63.1681614208972; Sat, 15 Apr 2023 20:03:28 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id r17-20020a5d4e51000000b002f01e181c4asm7056363wrt.5.2023.04.15.20.03.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:28 -0700 (PDT) Message-Id: <6d6b80993749b9cec9ba6249d970da421de24e1d.1681614206.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:03 +0000 Subject: [PATCH 01/23] treewide: be explicit about dependence on strbuf.h Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- color.c | 1 + common-main.c | 1 + credential.c | 1 + date.c | 1 + ll-merge.c | 1 + split-index.c | 1 + t/helper/test-mergesort.c | 1 + t/helper/test-oid-array.c | 1 + t/helper/test-oidtree.c | 1 + t/helper/test-parse-options.c | 1 + t/helper/test-string-list.c | 1 + wrapper.c | 1 + ws.c | 1 + 13 files changed, 13 insertions(+) diff --git a/color.c b/color.c index 6031998d3ea..f8a25ca807b 100644 --- a/color.c +++ b/color.c @@ -5,6 +5,7 @@ #include "gettext.h" #include "hex.h" #include "pager.h" +#include "strbuf.h" static int git_use_color_default = GIT_COLOR_AUTO; int color_stdout_is_tty = -1; diff --git a/common-main.c b/common-main.c index f3193173535..601a875e2fb 100644 --- a/common-main.c +++ b/common-main.c @@ -3,6 +3,7 @@ #include "gettext.h" #include "attr.h" #include "setup.h" +#include "strbuf.h" #include "trace2.h" /* diff --git a/credential.c b/credential.c index e6417bf8804..42194efc9e0 100644 --- a/credential.c +++ b/credential.c @@ -8,6 +8,7 @@ #include "url.h" #include "prompt.h" #include "sigchain.h" +#include "strbuf.h" #include "urlmatch.h" #include "git-compat-util.h" diff --git a/date.c b/date.c index e944c8905af..bc030da012f 100644 --- a/date.c +++ b/date.c @@ -8,6 +8,7 @@ #include "date.h" #include "gettext.h" #include "pager.h" +#include "strbuf.h" /* * This is like mktime, but without normalization of tm_wday and tm_yday. diff --git a/ll-merge.c b/ll-merge.c index 28bc94c45d6..85517e668e3 100644 --- a/ll-merge.c +++ b/ll-merge.c @@ -12,6 +12,7 @@ #include "run-command.h" #include "ll-merge.h" #include "quote.h" +#include "strbuf.h" #include "wrapper.h" struct ll_merge_driver; diff --git a/split-index.c b/split-index.c index 5602b74994b..3fc4e91485a 100644 --- a/split-index.c +++ b/split-index.c @@ -3,6 +3,7 @@ #include "gettext.h" #include "mem-pool.h" #include "split-index.h" +#include "strbuf.h" #include "ewah/ewok.h" struct split_index *init_split_index(struct index_state *istate) diff --git a/t/helper/test-mergesort.c b/t/helper/test-mergesort.c index 737e0c52358..3aabae6c1c4 100644 --- a/t/helper/test-mergesort.c +++ b/t/helper/test-mergesort.c @@ -2,6 +2,7 @@ #include "cache.h" #include "mem-pool.h" #include "mergesort.h" +#include "strbuf.h" static uint32_t minstd_rand(uint32_t *state) { diff --git a/t/helper/test-oid-array.c b/t/helper/test-oid-array.c index fd6f73ea03b..ea3bf278984 100644 --- a/t/helper/test-oid-array.c +++ b/t/helper/test-oid-array.c @@ -3,6 +3,7 @@ #include "hex.h" #include "oid-array.h" #include "setup.h" +#include "strbuf.h" static int print_oid(const struct object_id *oid, void *data) { diff --git a/t/helper/test-oidtree.c b/t/helper/test-oidtree.c index edcb7e9f448..796c9811e0f 100644 --- a/t/helper/test-oidtree.c +++ b/t/helper/test-oidtree.c @@ -3,6 +3,7 @@ #include "hex.h" #include "oidtree.h" #include "setup.h" +#include "strbuf.h" static enum cb_next print_oid(const struct object_id *oid, void *data) { diff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c index 506835521a4..20a81a1eb21 100644 --- a/t/helper/test-parse-options.c +++ b/t/helper/test-parse-options.c @@ -1,6 +1,7 @@ #include "test-tool.h" #include "cache.h" #include "parse-options.h" +#include "strbuf.h" #include "string-list.h" #include "trace2.h" diff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c index 2123dda85bf..959f27c74c6 100644 --- a/t/helper/test-string-list.c +++ b/t/helper/test-string-list.c @@ -1,5 +1,6 @@ #include "test-tool.h" #include "cache.h" +#include "strbuf.h" #include "string-list.h" /* diff --git a/wrapper.c b/wrapper.c index c130d7518bf..e80f83498d8 100644 --- a/wrapper.c +++ b/wrapper.c @@ -5,6 +5,7 @@ #include "abspath.h" #include "config.h" #include "gettext.h" +#include "strbuf.h" #include "trace2.h" #include "wrapper.h" diff --git a/ws.c b/ws.c index da3d0e28cbb..036ccb8ee9d 100644 --- a/ws.c +++ b/ws.c @@ -5,6 +5,7 @@ */ #include "cache.h" #include "attr.h" +#include "strbuf.h" static struct whitespace_rule { const char *rule_name; From patchwork Sun Apr 16 03:03:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212680 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01C3DC77B71 for ; Sun, 16 Apr 2023 03:03:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230099AbjDPDDo (ORCPT ); Sat, 15 Apr 2023 23:03:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230009AbjDPDDe (ORCPT ); Sat, 15 Apr 2023 23:03:34 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BD4D2718 for ; Sat, 15 Apr 2023 20:03:31 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id l31-20020a05600c1d1f00b003f1718d89b2so283354wms.0 for ; Sat, 15 Apr 2023 20:03:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614209; x=1684206209; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=l0HmzcHwed6ewbtQEwqHWQI6W3WAuOMs2WQXW3DKngU=; b=Yj4AbOYaDMfFffJCBpePz85m9j7WUk460ontdonA6l1a+a8ejRnYkngjtUDGnDX3Rg DxSerE/ghZF2BWybh5wS9n9YpcK/+j5xYy6CmJxqXylDfgWxNYNqKjOpQg2gZ6jHytr+ PfuZ8bpYid12MuT3+2rOAm25OegxvOR2zUaQaniHUq/Xo0uqrZRovnuoaOT77JiSwtAJ qeYGtcmu0W1iT7JR8/lnKm1jcyy/uG67Wgjh5lnAnz3q9a+AZe/D3azgJB59RFoQyZU6 nUVkMK8jr+Y6uzat0hUzxq04SwONYqNW+14fXk5dAVvtM9gb3kaR7/XJViCxHhXl8EMc RHdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614209; x=1684206209; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l0HmzcHwed6ewbtQEwqHWQI6W3WAuOMs2WQXW3DKngU=; b=luwEhTf66hwgeNH6DNwe2jdsd7+OdOGoIEdNp9fXCbCbP1xR6K8uq9Dou+9K3kFBZC wO2N3+mP/CnC0m0PUbPiSaW8cW4mT5wrGy/pgZC5/OPyGu0zflgda0q7iG3RgMG9MsI2 HtULjIs1bgZzadFdlzQmgb2VOtN1F77ZKGRc+AXneDP9PXIdAg6PCgQZ2CFAKPvGn3Xj 1zoB2oE7UavDAYxWBoUO2UhBxb3GZVk2Lydu9/XxeHsgVfU5F14NdrLkke+VQT8nlphX 05IUq4P8zBnsR5XQdQVTI9W6ys20LTZIgpelVzNRpAxSmnZeXspxzGsrNoUlDAPpk9us 38LA== X-Gm-Message-State: AAQBX9fV9bGqw5EiCQVYHQwmW/JMwAqAqafbwK+iicllzDqheVzHBHUN +zi/D7TTyouMD6BjZXZp4a+C6AH8gjY= X-Google-Smtp-Source: AKy350bLaAnFAb4mSpZuVXKOisNQCfnMWtFWy8c58B2c1+sdwGyJRbN0pgBJIiO5TVDr4sRq23bpRg== X-Received: by 2002:a05:600c:2208:b0:3ee:93c8:4a6f with SMTP id z8-20020a05600c220800b003ee93c84a6fmr7848147wml.32.1681614209547; Sat, 15 Apr 2023 20:03:29 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id k16-20020adff290000000b002f53fa16239sm6991220wro.103.2023.04.15.20.03.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:29 -0700 (PDT) Message-Id: <9f9a3561295de9f9af33b574d7e1d5d752ed76cf.1681614206.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:04 +0000 Subject: [PATCH 02/23] symlinks.h: move declarations for symlinks.c functions from cache.h Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- apply.c | 1 + builtin/checkout.c | 1 + builtin/update-index.c | 1 + cache.h | 22 ---------------------- compat/mingw.c | 1 + diff-lib.c | 1 + dir.c | 1 + entry.c | 1 + merge-recursive.c | 1 + parallel-checkout.c | 1 + pathspec.c | 1 + preload-index.c | 1 + read-cache.c | 1 + run-command.c | 1 + symlinks.c | 3 ++- symlinks.h | 28 ++++++++++++++++++++++++++++ unpack-trees.c | 1 + 17 files changed, 44 insertions(+), 23 deletions(-) create mode 100644 symlinks.h diff --git a/apply.c b/apply.c index 2868cef5ddd..efe2dcb0e62 100644 --- a/apply.c +++ b/apply.c @@ -30,6 +30,7 @@ #include "apply.h" #include "entry.h" #include "setup.h" +#include "symlinks.h" #include "wrapper.h" struct gitdiff_data { diff --git a/builtin/checkout.c b/builtin/checkout.c index 6f5d82ed3d3..715eeb5048f 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -28,6 +28,7 @@ #include "setup.h" #include "submodule.h" #include "submodule-config.h" +#include "symlinks.h" #include "trace2.h" #include "tree.h" #include "tree-walk.h" diff --git a/builtin/update-index.c b/builtin/update-index.c index 33b00cef151..58bbc80db77 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -23,6 +23,7 @@ #include "dir.h" #include "setup.h" #include "split-index.h" +#include "symlinks.h" #include "fsmonitor.h" #include "write-or-die.h" diff --git a/cache.h b/cache.h index 2f21704da9e..e225964b3ea 100644 --- a/cache.h +++ b/cache.h @@ -614,28 +614,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1, int name_compare(const char *name1, size_t len1, const char *name2, size_t len2); int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2); -struct cache_def { - struct strbuf path; - int flags; - int track_flags; - int prefix_len_stat_func; -}; -#define CACHE_DEF_INIT { \ - .path = STRBUF_INIT, \ -} -static inline void cache_def_clear(struct cache_def *cache) -{ - strbuf_release(&cache->path); -} - -int has_symlink_leading_path(const char *name, int len); -int threaded_has_symlink_leading_path(struct cache_def *, const char *, int); -int check_leading_path(const char *name, int len, int warn_on_lstat_err); -int has_dirs_only_path(const char *name, int len, int prefix_len); -void invalidate_lstat_cache(void); -void schedule_dir_for_removal(const char *name, int len); -void remove_scheduled_dirs(void); - struct pack_window { struct pack_window *next; unsigned char *base; diff --git a/compat/mingw.c b/compat/mingw.c index abbc3faf32f..d06cdc6254f 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -13,6 +13,7 @@ #include "../config.h" #include "../environment.h" #include "../trace2.h" +#include "../symlinks.h" #include "../wrapper.h" #include "dir.h" #include "gettext.h" diff --git a/diff-lib.c b/diff-lib.c index d292405a262..60e979dc1bd 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -14,6 +14,7 @@ #include "unpack-trees.h" #include "refs.h" #include "submodule.h" +#include "symlinks.h" #include "trace.h" #include "dir.h" #include "fsmonitor.h" diff --git a/dir.c b/dir.c index aa840995c40..ed262fa6e43 100644 --- a/dir.c +++ b/dir.c @@ -25,6 +25,7 @@ #include "fsmonitor.h" #include "setup.h" #include "submodule-config.h" +#include "symlinks.h" #include "trace2.h" #include "wrapper.h" diff --git a/entry.c b/entry.c index d89e61fa641..91a540bd29f 100644 --- a/entry.c +++ b/entry.c @@ -7,6 +7,7 @@ #include "hex.h" #include "streaming.h" #include "submodule.h" +#include "symlinks.h" #include "progress.h" #include "fsmonitor.h" #include "entry.h" diff --git a/merge-recursive.c b/merge-recursive.c index 9875bdb11cb..d4d2ab05b2e 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -30,6 +30,7 @@ #include "string-list.h" #include "submodule-config.h" #include "submodule.h" +#include "symlinks.h" #include "tag.h" #include "tree-walk.h" #include "unpack-trees.h" diff --git a/parallel-checkout.c b/parallel-checkout.c index 50fd7fe31ef..7f0569cc930 100644 --- a/parallel-checkout.c +++ b/parallel-checkout.c @@ -10,6 +10,7 @@ #include "run-command.h" #include "sigchain.h" #include "streaming.h" +#include "symlinks.h" #include "thread-utils.h" #include "trace2.h" #include "wrapper.h" diff --git a/pathspec.c b/pathspec.c index 6972d515f0c..ec335a214e2 100644 --- a/pathspec.c +++ b/pathspec.c @@ -8,6 +8,7 @@ #include "attr.h" #include "setup.h" #include "strvec.h" +#include "symlinks.h" #include "quote.h" /* diff --git a/preload-index.c b/preload-index.c index 4abf9c983b2..7a26b08c213 100644 --- a/preload-index.c +++ b/preload-index.c @@ -11,6 +11,7 @@ #include "progress.h" #include "thread-utils.h" #include "repository.h" +#include "symlinks.h" #include "trace2.h" /* diff --git a/read-cache.c b/read-cache.c index f225bf44cd0..206c003e558 100644 --- a/read-cache.c +++ b/read-cache.c @@ -30,6 +30,7 @@ #include "trace2.h" #include "varint.h" #include "split-index.h" +#include "symlinks.h" #include "utf8.h" #include "fsmonitor.h" #include "thread-utils.h" diff --git a/run-command.c b/run-command.c index e64bb08a5bf..d4247d5fcc6 100644 --- a/run-command.c +++ b/run-command.c @@ -5,6 +5,7 @@ #include "gettext.h" #include "sigchain.h" #include "strvec.h" +#include "symlinks.h" #include "thread-utils.h" #include "strbuf.h" #include "string-list.h" diff --git a/symlinks.c b/symlinks.c index 27ecc93693b..b29e340c2da 100644 --- a/symlinks.c +++ b/symlinks.c @@ -1,6 +1,7 @@ -#include "cache.h" +#include "git-compat-util.h" #include "gettext.h" #include "setup.h" +#include "symlinks.h" static int threaded_check_leading_path(struct cache_def *cache, const char *name, int len, int warn_on_lstat_err); diff --git a/symlinks.h b/symlinks.h new file mode 100644 index 00000000000..7ae3d5b8569 --- /dev/null +++ b/symlinks.h @@ -0,0 +1,28 @@ +#ifndef SYMLINKS_H +#define SYMLINKS_H + +#include "strbuf.h" + +struct cache_def { + struct strbuf path; + int flags; + int track_flags; + int prefix_len_stat_func; +}; +#define CACHE_DEF_INIT { \ + .path = STRBUF_INIT, \ +} +static inline void cache_def_clear(struct cache_def *cache) +{ + strbuf_release(&cache->path); +} + +int has_symlink_leading_path(const char *name, int len); +int threaded_has_symlink_leading_path(struct cache_def *, const char *, int); +int check_leading_path(const char *name, int len, int warn_on_lstat_err); +int has_dirs_only_path(const char *name, int len, int prefix_len); +void invalidate_lstat_cache(void); +void schedule_dir_for_removal(const char *name, int len); +void remove_scheduled_dirs(void); + +#endif /* SYMLINKS_H */ diff --git a/unpack-trees.c b/unpack-trees.c index c6de2ca5a7e..e8a5295e737 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -18,6 +18,7 @@ #include "sparse-index.h" #include "submodule.h" #include "submodule-config.h" +#include "symlinks.h" #include "trace2.h" #include "fsmonitor.h" #include "object-store.h" From patchwork Sun Apr 16 03:03:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212679 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 123B8C77B70 for ; Sun, 16 Apr 2023 03:03:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230091AbjDPDDi (ORCPT ); Sat, 15 Apr 2023 23:03:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230036AbjDPDDd (ORCPT ); Sat, 15 Apr 2023 23:03:33 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E83DB2720 for ; Sat, 15 Apr 2023 20:03:31 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id hg25-20020a05600c539900b003f05a99a841so19416201wmb.3 for ; Sat, 15 Apr 2023 20:03:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614210; x=1684206210; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=Iyn6nKlQw9yGWcfidM3+jxNkwrI+OV5y+tjEV6icvb4=; b=EFqlHyK7jBODpjycWbJuWubcT92a0803pu8gNEdPWElj3MZvzpclzAnNzGgRG7maP1 rJmHyflUnhWLpfzGrRMfpucihrcFTumHnBsWfL6leieYljF0pB3EeeOsXosoXkqYbYNd +ynj46x/hBSjWXaJAfWHM1n/1bRGCtzAZogrJq3hLmr9xNKGaLuePsFbpVudh6R5boZM xeMyDASZd+1tf+FI3cpuemPT6ZbtQp1BJERM3bozNrIdZWEeT2jLVHW6mCWTPgtkmlzR W0PtVNenL1vWlVST6VtdHFpLoy9G4I2oIAdqLaBXW9rbxXEocjjuqlJC+MIF6VrfHH45 N+ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614210; x=1684206210; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Iyn6nKlQw9yGWcfidM3+jxNkwrI+OV5y+tjEV6icvb4=; b=irOIysZUrceHsSorrvS/rIxr2YEvlHd6xPbLmQKugiedSA1YbTKM5N2rNMY8SliEIi Oqu9ah0S76z4s8C7Wu+sbXsHIyokNbiDtGFQCQ7toZWCDNq3bv087MJbG2U8jdJPF/T6 ZSOUYK+6nWkUwUbnW6/nsIsRxjyTB7JCJfOfbB+SrDUENsMXEPNHuGwIJwOdo5pVwG5M xhske07GvSnjhyGN49AwLffmLeyKrgE127/+DYMh/6FhFZN2d9016e2EWDNarHOFB5Zm 8b73HyxkELN1Lv6m67GuGWSGjDOlc/KwcZWxA4HiBrORpmK2cng0/htZyufagbjYZ/ob cMJw== X-Gm-Message-State: AAQBX9cy41hJ7GNrIjH3MUw4QgYhdWXFWOtZU7yqOcFuQQlBhwRuC62f 68gUOqaFVUF/6YPg2KhAmYrC/I95LG0= X-Google-Smtp-Source: AKy350ZiBHScwAGDaw6y8DbnT8O6FOQbzsY2Tg/Y0IETtN9lN0QYUYdI1CfNJNJHbfGN8bL01wbSeg== X-Received: by 2002:a05:600c:4688:b0:3f1:65d4:30f7 with SMTP id p8-20020a05600c468800b003f165d430f7mr2743030wmo.10.1681614210223; Sat, 15 Apr 2023 20:03:30 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id r17-20020a5d4e51000000b002f01e181c4asm7056392wrt.5.2023.04.15.20.03.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:29 -0700 (PDT) Message-Id: <003548de707f57cb9908b6dfbdf42954f668ee43.1681614206.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:05 +0000 Subject: [PATCH 03/23] protocol.h: move definition of DEFAULT_GIT_PORT from cache.h Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- cache.h | 21 --------------------- daemon.c | 1 + protocol.h | 21 +++++++++++++++++++++ 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/cache.h b/cache.h index e225964b3ea..ffec289dc5d 100644 --- a/cache.h +++ b/cache.h @@ -39,27 +39,6 @@ #define S_DIFFTREE_IFXMIN_NEQ 0x80000000 -/* - * Intensive research over the course of many years has shown that - * port 9418 is totally unused by anything else. Or - * - * Your search - "port 9418" - did not match any documents. - * - * as www.google.com puts it. - * - * This port has been properly assigned for git use by IANA: - * git (Assigned-9418) [I06-050728-0001]. - * - * git 9418/tcp git pack transfer service - * git 9418/udp git pack transfer service - * - * with Linus Torvalds as the point of - * contact. September 2005. - * - * See http://www.iana.org/assignments/port-numbers - */ -#define DEFAULT_GIT_PORT 9418 - /* * Basic data structures for the directory cache */ diff --git a/daemon.c b/daemon.c index db8a31a6ea2..75c3c064574 100644 --- a/daemon.c +++ b/daemon.c @@ -4,6 +4,7 @@ #include "config.h" #include "environment.h" #include "pkt-line.h" +#include "protocol.h" #include "run-command.h" #include "setup.h" #include "strbuf.h" diff --git a/protocol.h b/protocol.h index cef1a4a01c7..de66bf80f84 100644 --- a/protocol.h +++ b/protocol.h @@ -1,6 +1,27 @@ #ifndef PROTOCOL_H #define PROTOCOL_H +/* + * Intensive research over the course of many years has shown that + * port 9418 is totally unused by anything else. Or + * + * Your search - "port 9418" - did not match any documents. + * + * as www.google.com puts it. + * + * This port has been properly assigned for git use by IANA: + * git (Assigned-9418) [I06-050728-0001]. + * + * git 9418/tcp git pack transfer service + * git 9418/udp git pack transfer service + * + * with Linus Torvalds as the point of + * contact. September 2005. + * + * See http://www.iana.org/assignments/port-numbers + */ +#define DEFAULT_GIT_PORT 9418 + enum protocol_version { protocol_unknown_version = -1, protocol_v0 = 0, From patchwork Sun Apr 16 03:03:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212682 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B238BC77B71 for ; Sun, 16 Apr 2023 03:03:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230107AbjDPDDt (ORCPT ); Sat, 15 Apr 2023 23:03:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230044AbjDPDDe (ORCPT ); Sat, 15 Apr 2023 23:03:34 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 989A926A6 for ; Sat, 15 Apr 2023 20:03:32 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id he11-20020a05600c540b00b003ef6d684102so10092994wmb.3 for ; Sat, 15 Apr 2023 20:03:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614211; x=1684206211; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=Yg9dCGj/E41vODRP6M1NnnQyNQK9Qh1cjUc72jXAaU4=; b=sjY/AcK8D2Db/hK7MpsP1+OBiq8DrOxJ7wwM3xnuWTdOvA5PsuIuWuh1LhA9l2PNsa ErpIytr95dxnX4aMOgk3JdADfCjb15oKSSmg6PjRKT6xbmpAedeErogCN+CARv1yogzp CV2qrFamX9+firbNSnQo2U2+TE8rXJioLLAKJDYyhiuOv55Evs7U/44sdLrQSgpV4xoZ REHBDtjoxpzl8Mv7fwmLRNxnNKGL1QOUnw/RVe0eNpoIx+rND9QfyWlql7r5qHSFtGzG 7OT6K468oenk2r9qe9NKTOpUDUSpnJKi41oMbkYi1YaCeFchrWen4W15fDbPJ3KzcxIR WbUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614211; x=1684206211; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Yg9dCGj/E41vODRP6M1NnnQyNQK9Qh1cjUc72jXAaU4=; b=JTVbDx9RAUPQ3eLJDH22M3jzDICX/Mvs63R5IhcjS/YdqTJKgRHSmL5FrGwo1fc2rk ceC+7hUw2hgXfeXrbU1C05Jdr8NPD53L8MMStDFtGSnDqpEj406REsRzmoTkkgPEuwbe quKWPJD76JRIVTfurHttE5BMuLRFpya8syzuB/Iw511X1xfcTLotcFQhE5WREu1QTJNs eisJVIfiDUg6L4dzd9mO+3GrD6XXq/a00ecwj7mhhHfMhiv0RB8PVE/kWBXmX0Qf+QXl KC2XtI2gzDEIMxU3tochjw+blQXdDqQVfTtdfrrifY6QQQGSL15LEG6/QO+93ndniq3p +odQ== X-Gm-Message-State: AAQBX9e/cVyCaHfViAQ6saaqC3lQ4wfSIZQNZ7UTNUon3A4S7okm2sw6 ++f42E9fFs3dJY0nHWkmYvcjBOybEjY= X-Google-Smtp-Source: AKy350boPeRdc8UrsA8qRdZn3t1uUX2mCT3dxrXQHEw4RGFr3GecWfiGV9OIWf5kbVk+3Wt6PyJjHw== X-Received: by 2002:a7b:ca50:0:b0:3f1:661e:4686 with SMTP id m16-20020a7bca50000000b003f1661e4686mr2724696wml.7.1681614210949; Sat, 15 Apr 2023 20:03:30 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id fc12-20020a05600c524c00b003f0a0315ce4sm10819760wmb.47.2023.04.15.20.03.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:30 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:06 +0000 Subject: [PATCH 04/23] packfile.h: move pack_window and pack_entry from cache.h Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- cache.h | 14 -------------- packfile.h | 16 ++++++++++++++-- t/helper/test-read-midx.c | 1 + 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/cache.h b/cache.h index ffec289dc5d..ffb9028f015 100644 --- a/cache.h +++ b/cache.h @@ -593,20 +593,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1, int name_compare(const char *name1, size_t len1, const char *name2, size_t len2); int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2); -struct pack_window { - struct pack_window *next; - unsigned char *base; - off_t offset; - size_t len; - unsigned int last_used; - unsigned int inuse_cnt; -}; - -struct pack_entry { - off_t offset; - struct packed_git *p; -}; - /* Dumb servers support */ int update_server_info(int); diff --git a/packfile.h b/packfile.h index 665603b696a..c3692308b8d 100644 --- a/packfile.h +++ b/packfile.h @@ -6,10 +6,22 @@ /* in object-store.h */ struct packed_git; -struct pack_entry; -struct pack_window; struct object_info; +struct pack_window { + struct pack_window *next; + unsigned char *base; + off_t offset; + size_t len; + unsigned int last_used; + unsigned int inuse_cnt; +}; + +struct pack_entry { + off_t offset; + struct packed_git *p; +}; + /* * Generate the filename to be used for a pack file with checksum "sha1" and * extension "ext". The result is written into the strbuf "buf", overwriting diff --git a/t/helper/test-read-midx.c b/t/helper/test-read-midx.c index 05c4f2b2625..b32abff7f11 100644 --- a/t/helper/test-read-midx.c +++ b/t/helper/test-read-midx.c @@ -5,6 +5,7 @@ #include "repository.h" #include "object-store.h" #include "pack-bitmap.h" +#include "packfile.h" #include "setup.h" static int read_midx_file(const char *object_dir, int show_objects) From patchwork Sun Apr 16 03:03:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212683 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BCCCC77B71 for ; Sun, 16 Apr 2023 03:03:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230134AbjDPDDv (ORCPT ); Sat, 15 Apr 2023 23:03:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230049AbjDPDDf (ORCPT ); Sat, 15 Apr 2023 23:03:35 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CBCA26AA for ; Sat, 15 Apr 2023 20:03:33 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-2f55ffdbaedso376348f8f.2 for ; Sat, 15 Apr 2023 20:03:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614211; x=1684206211; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=Uz+LsNK18ggreqmDEFWGm3x58LxSkDlwUlBEkEdHU8c=; b=mNtvxg2HGHEiqCxUoTI2KD/XQSBGEItadMpE9P1ZdJAG1rqQvTnCTOmr27twSStqrR dqCK+DHquvhfZhPgGzLtq4gStAJhA/JmmsgAzY3nILn48Y274rAKgrG+h9N3LyUjlrzR GAM6oveTwUYpgx02JLEksFPmuaDru3SAXsKC63qY+XO7o/iRz0lefCAvoL61Zul+EO9b kogGvK1AC3em2cFMfrmiO6VCkjeX87mYzBYbx1AY4KM11ytqBTvVv+xj08P/vyzmLfLG vW5Lkip9iP1mUxHooUjYqZNBQWm2Gso5ARAghNtKD7lHBHA5ZM0BWyeSUH0FQgvANAiL 6jtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614211; x=1684206211; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Uz+LsNK18ggreqmDEFWGm3x58LxSkDlwUlBEkEdHU8c=; b=Li1EuSG2TUV5nY7yaLCGk1YM1qgRHVhA1uRQtIuLL9SJOJ6tOOxx+HmqUbiLJfMbHx kaJqv4tUFVjXNxNNsvTesjiddlJts0N+KaKERPaPa2M54PcAS82EqKa9W3xBRAjMEkhT /I6vdqwZXL/1Bg5XLtUpzOTLbBXIL5WbqwZ5l98IXsyD1QASvh1kLspPDknL0c8eC+1f BIPakkj+H1MMgpuqyB7F5C2Fk60CDVf1yRVbCT5NZI+bvf3bOnjyad0X20YvBvbn8a+U tX1vCMlu8JSDGpelNLJKYlD/O/cp5kxcOJRs2aby/2Mc9aNII/tjajip9IuJTC2yg6+L LMaQ== X-Gm-Message-State: AAQBX9cnAeMtUcwcs7i5VmF6q1H9eqca6Mur1ZWgoRlBa+hpqNXYyTOM iybklUQa853712KNQCkflPKQzTV5XvU= X-Google-Smtp-Source: AKy350bWE02tRQKVsm2dy/ePTztXeeiM3p5xot7I01Vk5haOmXLRYe7skdJcqcE/K6xnKFWT5DXcNQ== X-Received: by 2002:a5d:6342:0:b0:2ce:aa2d:c625 with SMTP id b2-20020a5d6342000000b002ceaa2dc625mr2193849wrw.22.1681614211492; Sat, 15 Apr 2023 20:03:31 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id s9-20020a5d4ec9000000b002cde25fba30sm7087702wrv.1.2023.04.15.20.03.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:31 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:07 +0000 Subject: [PATCH 05/23] server-info.h: move declarations for server-info.c functions from cache.h Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- builtin/receive-pack.c | 1 + builtin/repack.c | 1 + builtin/update-server-info.c | 1 + cache.h | 3 --- server-info.c | 3 ++- server-info.h | 7 +++++++ 6 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 server-info.h diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 7d921170f1c..dae99e4554d 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -33,6 +33,7 @@ #include "object-store.h" #include "protocol.h" #include "commit-reach.h" +#include "server-info.h" #include "trace.h" #include "trace2.h" #include "worktree.h" diff --git a/builtin/repack.c b/builtin/repack.c index df4d8e0f0ba..bed2c2aaafb 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -7,6 +7,7 @@ #include "hex.h" #include "parse-options.h" #include "run-command.h" +#include "server-info.h" #include "sigchain.h" #include "strbuf.h" #include "string-list.h" diff --git a/builtin/update-server-info.c b/builtin/update-server-info.c index e7bff27ae40..19dce3c0655 100644 --- a/builtin/update-server-info.c +++ b/builtin/update-server-info.c @@ -3,6 +3,7 @@ #include "builtin.h" #include "gettext.h" #include "parse-options.h" +#include "server-info.h" static const char * const update_server_info_usage[] = { "git update-server-info [-f | --force]", diff --git a/cache.h b/cache.h index ffb9028f015..2eb4546473f 100644 --- a/cache.h +++ b/cache.h @@ -593,9 +593,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1, int name_compare(const char *name1, size_t len1, const char *name2, size_t len2); int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2); -/* Dumb servers support */ -int update_server_info(int); - #define COPY_READ_ERROR (-2) #define COPY_WRITE_ERROR (-3) int copy_fd(int ifd, int ofd); diff --git a/server-info.c b/server-info.c index 68098ddd1ad..55aa04f00ab 100644 --- a/server-info.c +++ b/server-info.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "alloc.h" #include "dir.h" #include "environment.h" @@ -11,6 +11,7 @@ #include "packfile.h" #include "object-file.h" #include "object-store.h" +#include "server-info.h" #include "strbuf.h" #include "wrapper.h" diff --git a/server-info.h b/server-info.h new file mode 100644 index 00000000000..13bbde2c55f --- /dev/null +++ b/server-info.h @@ -0,0 +1,7 @@ +#ifndef SERVER_INFO_H +#define SERVER_INFO_H + +/* Dumb servers support */ +int update_server_info(int); + +#endif /* SERVER_INFO_H */ From patchwork Sun Apr 16 03:03:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212678 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22F2DC77B73 for ; Sun, 16 Apr 2023 03:03:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230096AbjDPDDm (ORCPT ); Sat, 15 Apr 2023 23:03:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230048AbjDPDDf (ORCPT ); Sat, 15 Apr 2023 23:03:35 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0928270D for ; Sat, 15 Apr 2023 20:03:33 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3f167d0c91bso6718675e9.2 for ; Sat, 15 Apr 2023 20:03:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614212; x=1684206212; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=C/xjejO9UpnBrcbYciWJDTtA7ZALLuxMP2eVG6ZMH0Q=; b=EguDCdWfgiFZmPm+PvHBV+bSjmlXD8F+1/l82GxmjRvMVRFTKwSxGIZnosfUM8zvqg GKwoA9OLSPXatqkCgCIPdvEfTvtTzJrN9eRhCmD0f1ng4IEhKIKEC5LQSEMQh8RThc5K 4D/Bb6o+d/5obphyH7c3FktbDdOZQOc5Re1RKVhb7gMOvBy3qOt1cLJiMsgP1MWyn9Ls IHJ4VvbW4dlsq10mr9KD0jSlDRVPZY8TyoTXySrV5VBrURdFrT35TySWZ2gjQNs73Nw9 gADUvk/1ALmLFVUK30AhYn/+T3l8ZvPK5h4l9VN+vsYBIXW1cypuinjcYae8sgMIFjhD 6HgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614212; x=1684206212; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C/xjejO9UpnBrcbYciWJDTtA7ZALLuxMP2eVG6ZMH0Q=; b=QvbTjIlAGjEsgqMleqSmnWe85ElSU110rgIdrmgHa/3iKpYHs4t7rNpefE3R9N/LD1 MM86VBR5uwbmkI3o1vQQWzcsX3uH5kU/RWbAiIqbeokLz4F7r+W3hcZPkqtOmMDXQPgo npM0M3AZt5KFViIxIepmunF0rkCV5Q1o642iRv61zZ+q4xi4pNBnj8IaGUurhlSP/T6T S6wU2i7q7ZX2FZDI3XsYDlnclWJPxtx5aSxKVQzJcNo8ZWBrQ15e/H54j1Wgom+R9VSd 4paFMXrAm53SBaLzcRAMfYb+KrXCLG9tQu/ff5YHIlGf813asWITksP9fKHpFRNZlo8f jpQw== X-Gm-Message-State: AAQBX9de5og9HWSFyaMXsIMN5n3FvW+/oT7UjnovMrSTX6DPT5qmzzHH 3uEbiW/HBGc2YQyGdY1MUeA/CETK00k= X-Google-Smtp-Source: AKy350Yly+x3Ct+4xwqPv65XWr6sjcEozEI+ayHY0lferEZgunl9Zfgo3DbwoqCazz6edSmhiyylpA== X-Received: by 2002:a5d:6dce:0:b0:2ef:b052:1296 with SMTP id d14-20020a5d6dce000000b002efb0521296mr2427666wrz.22.1681614212168; Sat, 15 Apr 2023 20:03:32 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m25-20020a056000181900b002f90a75b843sm1638203wrh.117.2023.04.15.20.03.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:31 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:08 +0000 Subject: [PATCH 06/23] copy.h: move declarations for copy.c functions from cache.h Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- builtin/bisect.c | 1 + builtin/clone.c | 1 + builtin/difftool.c | 1 + builtin/init-db.c | 1 + builtin/worktree.c | 1 + bundle-uri.c | 1 + cache.h | 6 ------ convert.c | 1 + copy.c | 1 + copy.h | 10 ++++++++++ pkt-line.c | 1 + refs/files-backend.c | 1 + rerere.c | 1 + sequencer.c | 1 + 14 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 copy.h diff --git a/builtin/bisect.c b/builtin/bisect.c index 4b2143d4557..4812450c393 100644 --- a/builtin/bisect.c +++ b/builtin/bisect.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "cache.h" +#include "copy.h" #include "environment.h" #include "gettext.h" #include "hex.h" diff --git a/builtin/clone.c b/builtin/clone.c index 4ed0a1d5aad..017ebc3faa8 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -13,6 +13,7 @@ #include "abspath.h" #include "advice.h" #include "config.h" +#include "copy.h" #include "environment.h" #include "gettext.h" #include "hex.h" diff --git a/builtin/difftool.c b/builtin/difftool.c index 3ffb0524be7..409507983f2 100644 --- a/builtin/difftool.c +++ b/builtin/difftool.c @@ -15,6 +15,7 @@ #include "cache.h" #include "abspath.h" #include "config.h" +#include "copy.h" #include "builtin.h" #include "run-command.h" #include "environment.h" diff --git a/builtin/init-db.c b/builtin/init-db.c index 6183f3fb3ff..cda6ee75eb5 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -6,6 +6,7 @@ #include "cache.h" #include "abspath.h" #include "config.h" +#include "copy.h" #include "environment.h" #include "gettext.h" #include "refs.h" diff --git a/builtin/worktree.c b/builtin/worktree.c index 0621f6f708e..0b411e9deee 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -2,6 +2,7 @@ #include "abspath.h" #include "checkout.h" #include "config.h" +#include "copy.h" #include "builtin.h" #include "dir.h" #include "environment.h" diff --git a/bundle-uri.c b/bundle-uri.c index 1ff1cf51dad..6d44662ee1f 100644 --- a/bundle-uri.c +++ b/bundle-uri.c @@ -1,6 +1,7 @@ #include "cache.h" #include "bundle-uri.h" #include "bundle.h" +#include "copy.h" #include "environment.h" #include "gettext.h" #include "object-store.h" diff --git a/cache.h b/cache.h index 2eb4546473f..2b661764794 100644 --- a/cache.h +++ b/cache.h @@ -593,12 +593,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1, int name_compare(const char *name1, size_t len1, const char *name2, size_t len2); int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2); -#define COPY_READ_ERROR (-2) -#define COPY_WRITE_ERROR (-3) -int copy_fd(int ifd, int ofd); -int copy_file(const char *dst, const char *src, int mode); -int copy_file_with_time(const char *dst, const char *src, int mode); - /* base85 */ int decode_85(char *dst, const char *line, int linelen); void encode_85(char *buf, const unsigned char *data, int bytes); diff --git a/convert.c b/convert.c index 5a2ea5308d6..7cf7bd0c883 100644 --- a/convert.c +++ b/convert.c @@ -2,6 +2,7 @@ #include "advice.h" #include "config.h" #include "convert.h" +#include "copy.h" #include "gettext.h" #include "hex.h" #include "object-store.h" diff --git a/copy.c b/copy.c index c3250f08221..db6b615c188 100644 --- a/copy.c +++ b/copy.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "copy.h" #include "wrapper.h" int copy_fd(int ifd, int ofd) diff --git a/copy.h b/copy.h new file mode 100644 index 00000000000..2af77cba864 --- /dev/null +++ b/copy.h @@ -0,0 +1,10 @@ +#ifndef COPY_H +#define COPY_H + +#define COPY_READ_ERROR (-2) +#define COPY_WRITE_ERROR (-3) +int copy_fd(int ifd, int ofd); +int copy_file(const char *dst, const char *src, int mode); +int copy_file_with_time(const char *dst, const char *src, int mode); + +#endif /* COPY_H */ diff --git a/pkt-line.c b/pkt-line.c index 3561d853584..8b5fa788517 100644 --- a/pkt-line.c +++ b/pkt-line.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "copy.h" #include "pkt-line.h" #include "gettext.h" #include "hex.h" diff --git a/refs/files-backend.c b/refs/files-backend.c index d0581ee41ac..1128a9af292 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1,5 +1,6 @@ #include "../cache.h" #include "../config.h" +#include "../copy.h" #include "../environment.h" #include "../gettext.h" #include "../hex.h" diff --git a/rerere.c b/rerere.c index 7abc94bf444..e968d413d65 100644 --- a/rerere.c +++ b/rerere.c @@ -2,6 +2,7 @@ #include "abspath.h" #include "alloc.h" #include "config.h" +#include "copy.h" #include "gettext.h" #include "hex.h" #include "lockfile.h" diff --git a/sequencer.c b/sequencer.c index fcca3b81447..c16df514434 100644 --- a/sequencer.c +++ b/sequencer.c @@ -3,6 +3,7 @@ #include "advice.h" #include "alloc.h" #include "config.h" +#include "copy.h" #include "environment.h" #include "gettext.h" #include "hex.h" From patchwork Sun Apr 16 03:03:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212684 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D51B1C77B71 for ; Sun, 16 Apr 2023 03:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230074AbjDPDD4 (ORCPT ); Sat, 15 Apr 2023 23:03:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230055AbjDPDDg (ORCPT ); Sat, 15 Apr 2023 23:03:36 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83B372724 for ; Sat, 15 Apr 2023 20:03:34 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3f1728c2a57so679275e9.0 for ; Sat, 15 Apr 2023 20:03:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614213; x=1684206213; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=IA6B9hWAldqZfZXVR8JjnS0tErAdEgGFl7Zm1+qIM0g=; b=L5dczQIru+GbAuTc/JYcRXS8MjQDlU+rHJTD9kKe9k1rHMygw8J969+Lw5KdRuYn9U SzALhWvOyUQ0uNq94vo8np3RenXqYDkUUSZ0FbW8fvUCDiP2PXvzffUUXo/8LjCN3Gly UH22X3kGAH108tzko7fs6JepB7xLP/4rCnEY+HnXFSqe1r1hlAmKZINQmlSevZbosDho eiTCdHlrHyq+iGfmrC5+cuyy7dAa80bx69o0rHqy+b4+hcpWhBAYwoAT5mGhNEjvcsGv H3ujuYb5R5iEb7t0POP6SD6wmiBsd8M+PN2zbv/v2bEVmcJHkkU5cG2OMRj9KM9/3EA7 F8tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614213; x=1684206213; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IA6B9hWAldqZfZXVR8JjnS0tErAdEgGFl7Zm1+qIM0g=; b=DCwXVOOsebOz23YODKPtGelNvSsJn8IOCTpCUCGdkdGRtk1lu5RqTXtKtK2g3PX4HF 8HfIYPll8Yj3NT88HIhH4SKHlLZtVAP0ff+BA8ZzN2LIf9aVNX4NOE85cLK3r4FjA77t GPcHupNjvSi1orSvTwNEjHXzK+tKwuqvVyUVyg/XIPgiXAYBDFvfEgwffbUDI+xOrIMp yAORTMJF3Pw+AFuLLRPDu2PxqZaj5nBDbMljggpZ8ROeyzLwFwbqnyEm75J0Q/6X+wsK o74CRyk9p3RZfze2g27IrNeQh2VVCs084voVPSIiE6umu8F78kSf3Ez3LuK0qkAFAzKL 7GDw== X-Gm-Message-State: AAQBX9ciH/jYsgXZMycrNxrbFIHcA8+pH3m0Je0Ay4b4ZLzi/uyifpZS wF1ckMSssqa0Y9kBefWWpDtzh8VE2dU= X-Google-Smtp-Source: AKy350bh8r8Tbq/3vfOGuqXNovltNWFHfG7iCwGOZTHDYrO8kDyw8y0Xwr1Jv1+hNXrip+FMEeklcA== X-Received: by 2002:adf:e686:0:b0:2e4:bfa0:8c29 with SMTP id r6-20020adfe686000000b002e4bfa08c29mr2449973wrm.50.1681614212937; Sat, 15 Apr 2023 20:03:32 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id r8-20020adfda48000000b002efacde3fc7sm7006425wrl.35.2023.04.15.20.03.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:32 -0700 (PDT) Message-Id: <9d9672ebf52fd1d7925ad58d82695dd21113244d.1681614206.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:09 +0000 Subject: [PATCH 07/23] base85.h: move declarations for base85.c functions from cache.h Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- apply.c | 1 + base85.c | 3 ++- base85.h | 7 +++++++ cache.h | 4 ---- diff.c | 1 + 5 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 base85.h diff --git a/apply.c b/apply.c index efe2dcb0e62..a65a354eef5 100644 --- a/apply.c +++ b/apply.c @@ -10,6 +10,7 @@ #include "cache.h" #include "abspath.h" #include "alloc.h" +#include "base85.h" #include "config.h" #include "object-store.h" #include "blob.h" diff --git a/base85.c b/base85.c index 5ca601ee14f..bbacdca31b3 100644 --- a/base85.c +++ b/base85.c @@ -1,4 +1,5 @@ -#include "cache.h" +#include "git-compat-util.h" +#include "base85.h" #undef DEBUG_85 diff --git a/base85.h b/base85.h new file mode 100644 index 00000000000..c835086e093 --- /dev/null +++ b/base85.h @@ -0,0 +1,7 @@ +#ifndef BASE85_H +#define BASE85_H + +int decode_85(char *dst, const char *line, int linelen); +void encode_85(char *buf, const unsigned char *data, int bytes); + +#endif /* BASE85_H */ diff --git a/cache.h b/cache.h index 2b661764794..b89f4c59802 100644 --- a/cache.h +++ b/cache.h @@ -593,10 +593,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1, int name_compare(const char *name1, size_t len1, const char *name2, size_t len2); int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2); -/* base85 */ -int decode_85(char *dst, const char *line, int linelen); -void encode_85(char *buf, const unsigned char *data, int bytes); - /* pkt-line.c */ void packet_trace_identity(const char *prog); diff --git a/diff.c b/diff.c index fa86d023196..e697f78a645 100644 --- a/diff.c +++ b/diff.c @@ -4,6 +4,7 @@ #include "cache.h" #include "abspath.h" #include "alloc.h" +#include "base85.h" #include "config.h" #include "convert.h" #include "environment.h" From patchwork Sun Apr 16 03:03:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212685 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D3EDC77B70 for ; Sun, 16 Apr 2023 03:04:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229937AbjDPDEB (ORCPT ); Sat, 15 Apr 2023 23:04:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230063AbjDPDDg (ORCPT ); Sat, 15 Apr 2023 23:03:36 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20B8230D5 for ; Sat, 15 Apr 2023 20:03:35 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-2eed43bfa4bso653345f8f.2 for ; Sat, 15 Apr 2023 20:03:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614213; x=1684206213; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=ORgi3XkRxetuqDIw16hCNyxvy587ZYTzf+hQdHh7H4g=; b=SeAy7KxcsF7fxksZRsbQaCschz5d1Aj7iYT+r5f1tjsaB7MRW8lUt7/Hr2K+14ZRb2 Rpd3r6BjfexMFGwZIHFpmCMfvI5sLRXHuMzMMEI+I5SZOME9LxcYCPRyXwAOSxSOqW8J MGkIxOpxxyzm45cte0BD1DbG8l5C8tpv+yQGACMzp6h//3cAAApue/BXjx46hacHyB23 jEv4TV2WLvAz2LrvQ0QgJk+6T+SF0t4s9uLphrdlFurrU73MxgARIwStKvNp5hx2186A hGPJA3C9ebMaHlLKOimm6co8trbfLgqYcDal6PgtQkyUAc6T2IRhaEJca6N3B1Ygv60D timQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614213; x=1684206213; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ORgi3XkRxetuqDIw16hCNyxvy587ZYTzf+hQdHh7H4g=; b=A2Qb6GXmtdJzYMk5I5GEPmzagWXNl6EumiAGnyv6i2vU4k8jWD2tqa2rWiD/gWhQRA arf8yycMUEe0udgY9elnAmqEYnIHRP9fHPHVrcNTAEaXsbW1q379cBd76YGvrjjn9ALd v+iJuh9t9kXEF3gc0Q9d7uk44lnGmUgFx7/n+D0bgeQUTlU3Q1E2IBUksHSL2+psFNvU XAq1Wt+q15hRY4xhgsA3SAdqIST0ofMr5PuPB2Bp/XoG74njuFCgveUYdC3CAj3TAxWk HECy7CtAnUfsU5abVGGAInrYv2fwBw1Xs3CkwzuoiCCiuim/CcSsQMB+Zr3jOIZWG2yq c11Q== X-Gm-Message-State: AAQBX9fiqbsQoigzruKRalWAGaTL/M8p09bsc9jfyg1xLJKVc8802FMD G6YgTgHV3fwE+s44OFobPN4Z/quJ6cI= X-Google-Smtp-Source: AKy350ZajKAhrDh7sczyRevEkzmJezBK6LmMbAjLT1oQJx7d5/dvPrQv4lZJPWvddPZ12F8DITPv0w== X-Received: by 2002:adf:fc41:0:b0:2f2:3dbf:6922 with SMTP id e1-20020adffc41000000b002f23dbf6922mr2287133wrs.22.1681614213512; Sat, 15 Apr 2023 20:03:33 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id f24-20020a7bcd18000000b003f09a9151c1sm8067097wmj.30.2023.04.15.20.03.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:33 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:10 +0000 Subject: [PATCH 08/23] pkt-line.h: move declarations for pkt-line.c functions from cache.h Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- builtin/bundle.c | 1 + builtin/clone.c | 1 + builtin/fetch.c | 1 + builtin/ls-remote.c | 1 + builtin/push.c | 1 + cache.h | 3 --- pkt-line.h | 2 ++ 7 files changed, 7 insertions(+), 3 deletions(-) diff --git a/builtin/bundle.c b/builtin/bundle.c index e68fc83d943..584d905d965 100644 --- a/builtin/bundle.c +++ b/builtin/bundle.c @@ -4,6 +4,7 @@ #include "setup.h" #include "strvec.h" #include "parse-options.h" +#include "pkt-line.h" #include "cache.h" #include "bundle.h" diff --git a/builtin/clone.c b/builtin/clone.c index 017ebc3faa8..fa300f483e9 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -39,6 +39,7 @@ #include "setup.h" #include "connected.h" #include "packfile.h" +#include "pkt-line.h" #include "list-objects-filter-options.h" #include "hook.h" #include "bundle.h" diff --git a/builtin/fetch.c b/builtin/fetch.c index 61e8ac113b1..4fee2a62376 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -29,6 +29,7 @@ #include "utf8.h" #include "packfile.h" #include "pager.h" +#include "pkt-line.h" #include "list-objects-filter-options.h" #include "commit-reach.h" #include "branch.h" diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c index 11d9424804a..7972febf726 100644 --- a/builtin/ls-remote.c +++ b/builtin/ls-remote.c @@ -3,6 +3,7 @@ #include "gettext.h" #include "hex.h" #include "transport.h" +#include "pkt-line.h" #include "ref-filter.h" #include "remote.h" #include "refs.h" diff --git a/builtin/push.c b/builtin/push.c index 6001e4ae0a4..7d2b0505aac 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -14,6 +14,7 @@ #include "remote.h" #include "transport.h" #include "parse-options.h" +#include "pkt-line.h" #include "submodule.h" #include "submodule-config.h" #include "send-pack.h" diff --git a/cache.h b/cache.h index b89f4c59802..fde782a96f0 100644 --- a/cache.h +++ b/cache.h @@ -593,9 +593,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1, int name_compare(const char *name1, size_t len1, const char *name2, size_t len2); int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2); -/* pkt-line.c */ -void packet_trace_identity(const char *prog); - /* add */ /* * return 0 if success, 1 - if addition of a file failed and diff --git a/pkt-line.h b/pkt-line.h index 8e9846f3151..7c23a4bfaf7 100644 --- a/pkt-line.h +++ b/pkt-line.h @@ -246,4 +246,6 @@ void packet_writer_error(struct packet_writer *writer, const char *fmt, ...); void packet_writer_delim(struct packet_writer *writer); void packet_writer_flush(struct packet_writer *writer); +void packet_trace_identity(const char *prog); + #endif From patchwork Sun Apr 16 03:03:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212686 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03276C77B71 for ; Sun, 16 Apr 2023 03:04:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230083AbjDPDED (ORCPT ); Sat, 15 Apr 2023 23:04:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230079AbjDPDDh (ORCPT ); Sat, 15 Apr 2023 23:03:37 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC34030E3 for ; Sat, 15 Apr 2023 20:03:35 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3f096839f72so7180075e9.1 for ; Sat, 15 Apr 2023 20:03:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614214; x=1684206214; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=9VKzPjlOVt0ttQYRbSkQR33ViI/ZjrwE7RAdiLHPLZg=; b=iTq1jmSrIsxRgyKA01Cr+u0A4JS8ou/0jVXbQk5GwlUl09uSkTVkbKqgOo6BG+rPQL +dSz1xQsoPD7zMur/oOqRRwV78lJRQ7GCHINJoFugfX918L+1sqS94EEYOp2W1u5YYbO oOhfmg3ASYd6eOGMkWbBZHqvT1KtgJlrBp2aAssW414oNEIonUtV5UU+o9PtUyr5NhPn ymVMb4KfBTlIOYZmtXLbl/NxsAXjTD61Irf8fgm6X/QdzMTFfpNyNVpTzZ5lFJ9rd5uh Tq7762XrA+plbgYb+P+XB4Y/LNDq++ly5+ncnPgAINh0O5QzJk7GYsqGti2AKzUCT58C UP/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614214; x=1684206214; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9VKzPjlOVt0ttQYRbSkQR33ViI/ZjrwE7RAdiLHPLZg=; b=Jb6O4JtSlVj9E9xB1RTbT4aN2gEryagCJTP3y5d0aTllLGlNGtjg7Hm+Rblu9XrPUX HxjnHUG/YP+9nzMpHUq8xLkTOT0KZq90XwSsbBMMwYxH6EDd5DoUHWw9Ty1hpeYcrAiz dBdnPqLoxc3fe18jOygLYGDG3eWB6fhx7r3bYFzrQobaVUOfppimpdIxu85C9dq7PLfP nudfaDiESyoFHyKYB8RUqjEfK8r0G/mHT+aqfzZM7C6vEWhXItiDBRoUXlRszjOHjqqc KgNrNVNaAx2UTnhLqapuSbMQ2wkr9TZyOjQVrUWtsxTjOBfkTADxuA1aJYA7PiArQ9xb UReg== X-Gm-Message-State: AAQBX9clupL4ULhpjDGxNp9bEi79raQxAUhwu1FiBzs8Qf6KU7I9PUEi aHn3CQlDVDT7geBIevFxBELdm+nF3dI= X-Google-Smtp-Source: AKy350azazLcTgUgKxTSvACL4REC6UbDEZ7/x/MWiktF43kggvKAZQg6c7LDMoP4XQWoAzQpc1Wa5g== X-Received: by 2002:adf:f852:0:b0:2f7:662:c87f with SMTP id d18-20020adff852000000b002f70662c87fmr2537052wrq.14.1681614214220; Sat, 15 Apr 2023 20:03:34 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id t3-20020a5d5343000000b002c55521903bsm7045882wrv.51.2023.04.15.20.03.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:34 -0700 (PDT) Message-Id: <11c6cd13e2b15687034b041ac5abc5c9d3906454.1681614206.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:11 +0000 Subject: [PATCH 09/23] match-trees.h: move declarations for match-trees.c functions from cache.h Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- cache.h | 4 ---- match-trees.c | 1 + match-trees.h | 10 ++++++++++ merge-ort.c | 1 + merge-recursive.c | 1 + t/helper/test-match-trees.c | 1 + 6 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 match-trees.h diff --git a/cache.h b/cache.h index fde782a96f0..0570f9ad07d 100644 --- a/cache.h +++ b/cache.h @@ -603,10 +603,6 @@ int add_files_to_cache(const char *prefix, const struct pathspec *pathspec, int /* diff.c */ extern int diff_auto_refresh_index; -/* match-trees.c */ -void shift_tree(struct repository *, const struct object_id *, const struct object_id *, struct object_id *, int); -void shift_tree_by(struct repository *, const struct object_id *, const struct object_id *, struct object_id *, const char *); - /* * whitespace rules. * used by both diff and apply diff --git a/match-trees.c b/match-trees.c index 5877fc64a8f..9b78d99507b 100644 --- a/match-trees.c +++ b/match-trees.c @@ -1,5 +1,6 @@ #include "cache.h" #include "hex.h" +#include "match-trees.h" #include "tree.h" #include "tree-walk.h" #include "object-store.h" diff --git a/match-trees.h b/match-trees.h new file mode 100644 index 00000000000..e3877acd583 --- /dev/null +++ b/match-trees.h @@ -0,0 +1,10 @@ +#ifndef MATCH_TREES_H +#define MATCH_TREES_H + +struct object_id; +struct repository; + +void shift_tree(struct repository *, const struct object_id *, const struct object_id *, struct object_id *, int); +void shift_tree_by(struct repository *, const struct object_id *, const struct object_id *, struct object_id *, const char *); + +#endif /* MATCH_TREES_H */ diff --git a/merge-ort.c b/merge-ort.c index 2c6a9ed9a41..65837db77f0 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -31,6 +31,7 @@ #include "hex.h" #include "entry.h" #include "ll-merge.h" +#include "match-trees.h" #include "mem-pool.h" #include "object-name.h" #include "object-store.h" diff --git a/merge-recursive.c b/merge-recursive.c index d4d2ab05b2e..8e87b6386d9 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -22,6 +22,7 @@ #include "hex.h" #include "ll-merge.h" #include "lockfile.h" +#include "match-trees.h" #include "object-file.h" #include "object-name.h" #include "object-store.h" diff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c index 3808e1ac38b..a498fece7a3 100644 --- a/t/helper/test-match-trees.c +++ b/t/helper/test-match-trees.c @@ -1,6 +1,7 @@ #include "test-tool.h" #include "cache.h" #include "hex.h" +#include "match-trees.h" #include "object-name.h" #include "setup.h" #include "tree.h" From patchwork Sun Apr 16 03:03:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212688 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46095C77B73 for ; Sun, 16 Apr 2023 03:04:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230155AbjDPDEJ (ORCPT ); Sat, 15 Apr 2023 23:04:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230108AbjDPDDu (ORCPT ); Sat, 15 Apr 2023 23:03:50 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C1B030FD for ; Sat, 15 Apr 2023 20:03:36 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id m39-20020a05600c3b2700b003f170e75bd3so184464wms.1 for ; Sat, 15 Apr 2023 20:03:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614214; x=1684206214; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=mrXcFxS4F9XvyH52gObTjZ4eSz6BCCXjHgXrK8G1Bcg=; b=HxMpgD9BhVOz0jtpuO0HPO8bKRJlnoccoM/cWp+eL+MPukfZeFXJ5WVfbYbO2xTNEu SWGevSbB/S37kYhILX4nkl8D337RCriVzko2Kr/dwhA0dZ9o8sn8wYCCYVWhbnsSqE5d vpyXiht/J0P0urux/13BhIFtU5WHPsdUEdyYB52DqclJ6C8/DOZ1LZhOjcT9h5VBnYfg rIdAxgWcneTbBCAQALGMBdfAurM/rIGXROj4o/8TGKGWmnaTH/jCJRd5MdsiHJ3RVJMK qB48HN3SSSAs9p3w6A1JSKvgE4IcW8noyF4tbdJ0hUMLqI98FiK+XCHENEzyvR3veMQ9 3anw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614214; x=1684206214; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mrXcFxS4F9XvyH52gObTjZ4eSz6BCCXjHgXrK8G1Bcg=; b=GuRRITD0fvFhD+uo7w6YFXDxcsaXgQHZZw6TNa5A+ORA7Zv4eeJx7DJ/YVvCSKfmLo YjfCz9W6py7HjsYL6mP/CGxv+oFxuiU73QRy7+WsgYcbOahaYMCBc1FLd/Ei/12/JyZC hRZhz2UXtt9W9aC0AfagbUEEzND2mSBRVNXeUYkQ0yf0OhzWU6dVpEzdjv4Wd9HWB9AL /imk7HQTOq13smP3DFAZLYOxHlNVF7uAvZ4KLPjBjS5qf/afMGl8Xtq++eT3BHkfAvl7 zr6YjKYnQR1POXNtuNj8qgb+dTLbL9Y5XpzZXIrvn0UDXOKkSLNVSNmvYqO1bm548MWt PXkw== X-Gm-Message-State: AAQBX9dl+inDMuql9FJVnvj1MLPaLUZXPc8KYaaZZm4wNbWbpBO9QFBA bnESE3H6jirzXYoSeY2lpe8liZlTmjg= X-Google-Smtp-Source: AKy350blts0Uzl6n6SWd8TjLHx24LpKUktcdyWnDPOkJkltkHWcF8eT5iYaefD7ZUgTsUE4+jN1NLg== X-Received: by 2002:a7b:cd19:0:b0:3f1:6980:2d01 with SMTP id f25-20020a7bcd19000000b003f169802d01mr2242192wmj.9.1681614214783; Sat, 15 Apr 2023 20:03:34 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id iw11-20020a05600c54cb00b003f0a96b21d3sm7705628wmb.7.2023.04.15.20.03.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:34 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:12 +0000 Subject: [PATCH 10/23] ws.h: move declarations for ws.c functions from cache.h Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- apply.c | 1 + cache.h | 26 -------------------------- config.c | 1 + diff.c | 1 + environment.c | 1 - ws.c | 5 ++++- ws.h | 33 +++++++++++++++++++++++++++++++++ 7 files changed, 40 insertions(+), 28 deletions(-) create mode 100644 ws.h diff --git a/apply.c b/apply.c index a65a354eef5..2de8bb203d7 100644 --- a/apply.c +++ b/apply.c @@ -32,6 +32,7 @@ #include "entry.h" #include "setup.h" #include "symlinks.h" +#include "ws.h" #include "wrapper.h" struct gitdiff_data { diff --git a/cache.h b/cache.h index 0570f9ad07d..dde275c9301 100644 --- a/cache.h +++ b/cache.h @@ -603,32 +603,6 @@ int add_files_to_cache(const char *prefix, const struct pathspec *pathspec, int /* diff.c */ extern int diff_auto_refresh_index; -/* - * whitespace rules. - * used by both diff and apply - * last two digits are tab width - */ -#define WS_BLANK_AT_EOL 0100 -#define WS_SPACE_BEFORE_TAB 0200 -#define WS_INDENT_WITH_NON_TAB 0400 -#define WS_CR_AT_EOL 01000 -#define WS_BLANK_AT_EOF 02000 -#define WS_TAB_IN_INDENT 04000 -#define WS_TRAILING_SPACE (WS_BLANK_AT_EOL|WS_BLANK_AT_EOF) -#define WS_DEFAULT_RULE (WS_TRAILING_SPACE|WS_SPACE_BEFORE_TAB|8) -#define WS_TAB_WIDTH_MASK 077 -/* All WS_* -- when extended, adapt diff.c emit_symbol */ -#define WS_RULE_MASK 07777 -extern unsigned whitespace_rule_cfg; -unsigned whitespace_rule(struct index_state *, const char *); -unsigned parse_whitespace_rule(const char *); -unsigned ws_check(const char *line, int len, unsigned ws_rule); -void ws_check_emit(const char *line, int len, unsigned ws_rule, FILE *stream, const char *set, const char *reset, const char *ws); -char *whitespace_error_string(unsigned ws); -void ws_fix_copy(struct strbuf *, const char *, int, unsigned, int *); -int ws_blank_line(const char *line, int len); -#define ws_tab_width(rule) ((rule) & WS_TAB_WIDTH_MASK) - /* ls-files */ void overlay_tree_on_index(struct index_state *istate, const char *tree_name, const char *prefix); diff --git a/config.c b/config.c index 9beba19b41c..97063a0743e 100644 --- a/config.c +++ b/config.c @@ -35,6 +35,7 @@ #include "setup.h" #include "trace2.h" #include "worktree.h" +#include "ws.h" #include "wrapper.h" #include "write-or-die.h" diff --git a/diff.c b/diff.c index e697f78a645..73d2ac03673 100644 --- a/diff.c +++ b/diff.c @@ -41,6 +41,7 @@ #include "object-name.h" #include "setup.h" #include "strmap.h" +#include "ws.h" #include "wrapper.h" #ifdef NO_FAST_WORKING_DIRECTORY diff --git a/environment.c b/environment.c index 8a96997539a..541f0b19acf 100644 --- a/environment.c +++ b/environment.c @@ -67,7 +67,6 @@ int read_replace_refs = 1; enum eol core_eol = EOL_UNSET; int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN; char *check_roundtrip_encoding = "SHIFT-JIS"; -unsigned whitespace_rule_cfg = WS_DEFAULT_RULE; enum branch_track git_branch_track = BRANCH_TRACK_REMOTE; enum rebase_setup_type autorebase = AUTOREBASE_NEVER; enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED; diff --git a/ws.c b/ws.c index 036ccb8ee9d..d356d4ec9ee 100644 --- a/ws.c +++ b/ws.c @@ -3,9 +3,12 @@ * * Copyright (c) 2007 Junio C Hamano */ -#include "cache.h" +#include "git-compat-util.h" #include "attr.h" #include "strbuf.h" +#include "ws.h" + +unsigned whitespace_rule_cfg = WS_DEFAULT_RULE; static struct whitespace_rule { const char *rule_name; diff --git a/ws.h b/ws.h new file mode 100644 index 00000000000..5ba676c5595 --- /dev/null +++ b/ws.h @@ -0,0 +1,33 @@ +#ifndef WS_H +#define WS_H + +struct index_state; +struct strbuf; + +/* + * whitespace rules. + * used by both diff and apply + * last two digits are tab width + */ +#define WS_BLANK_AT_EOL 0100 +#define WS_SPACE_BEFORE_TAB 0200 +#define WS_INDENT_WITH_NON_TAB 0400 +#define WS_CR_AT_EOL 01000 +#define WS_BLANK_AT_EOF 02000 +#define WS_TAB_IN_INDENT 04000 +#define WS_TRAILING_SPACE (WS_BLANK_AT_EOL|WS_BLANK_AT_EOF) +#define WS_DEFAULT_RULE (WS_TRAILING_SPACE|WS_SPACE_BEFORE_TAB|8) +#define WS_TAB_WIDTH_MASK 077 +/* All WS_* -- when extended, adapt diff.c emit_symbol */ +#define WS_RULE_MASK 07777 +extern unsigned whitespace_rule_cfg; +unsigned whitespace_rule(struct index_state *, const char *); +unsigned parse_whitespace_rule(const char *); +unsigned ws_check(const char *line, int len, unsigned ws_rule); +void ws_check_emit(const char *line, int len, unsigned ws_rule, FILE *stream, const char *set, const char *reset, const char *ws); +char *whitespace_error_string(unsigned ws); +void ws_fix_copy(struct strbuf *, const char *, int, unsigned, int *); +int ws_blank_line(const char *line, int len); +#define ws_tab_width(rule) ((rule) & WS_TAB_WIDTH_MASK) + +#endif /* WS_H */ From patchwork Sun Apr 16 03:03:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212687 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1520C77B70 for ; Sun, 16 Apr 2023 03:04:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230124AbjDPDEH (ORCPT ); Sat, 15 Apr 2023 23:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229702AbjDPDDi (ORCPT ); Sat, 15 Apr 2023 23:03:38 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD25026A6 for ; Sat, 15 Apr 2023 20:03:36 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id bd13-20020a05600c1f0d00b003f14c42cc99so2431587wmb.2 for ; Sat, 15 Apr 2023 20:03:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614215; x=1684206215; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=VIkGlAhmULKGxj9CHConEVpIpm56FQxo272CDrQqxBE=; b=Fo+QAlvg8+Q/Bg047HglvLS1LYXDb4iEA3M7pdV57xz//vuqhEZQ0SbNWrlAMePfxy +UeHROuDW+P52u2jC0isy7kCx5Cn2gLyMDpXOk9bf4VBn2kgpVnE6lkKwslqfENngZ4R gLjHVMYK1zJVvHngPGWEQYezAlB2d0YdQhwXXqMEODaffRArbacXKR402OgHFowXb+gG o3LHhAPrkZc5pcNaGVLPj2RHfRRAEbjNyS9CWgBTUXVkypKia/znJrkyYHvkrUeONk4+ /FC5gWfudnx45nt8ftoZ8rzWOuZFHJrbUaDNQrGt3Rr/ZNbd0gxKmqakeaR6RqtqK9U9 Srew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614215; x=1684206215; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VIkGlAhmULKGxj9CHConEVpIpm56FQxo272CDrQqxBE=; b=h8yEgWlQ7VBvGg7CLkY1E/m1Y4u/yeFlzCyL/LgphcAyGWPr/KUsK2CpF4E1xuuCpb gfVpf/JJzr2G7PzNuBMr4hvVzQrJeYHW14MO1JdQYVRlXcbm+jQTmu6GJJzg7pw8oad6 JqBl8we5yGgPXZ1NeJaPPb5lGO6dtpJf7n+7mwc73W7l5LxQqJt64bjyhZ8dVUlrGPYy RhR9CCBLZA0BUoA2lhMnt0i7dgNHsRk+cC+eUpfYUj2EQ+vHfOHydtHMMAuJVguKpfbS 3RdLAvxIOE3NvTE9xbpWMoV3IbJQiMDBgmbZwfQjRwswRxoUmTfw+ztA5M+m3Ns6TOa7 22rQ== X-Gm-Message-State: AAQBX9fMTu//JMd4LP1Zg5MWJJ7TQs6Z85cs8uwIc0+P4JabXP/W94jR h+NyUqGkNaYaY3UtvwqzdHlIrrzPW2g= X-Google-Smtp-Source: AKy350YE8BhZx71f7SyjW3DacN/LwNYjbxPvcBR9u9Iqg+o7UWtPSmj6VTULls3E0pEySES7Qww/Pw== X-Received: by 2002:a7b:cd8c:0:b0:3ee:4dc0:d4f2 with SMTP id y12-20020a7bcd8c000000b003ee4dc0d4f2mr7262091wmj.41.1681614215370; Sat, 15 Apr 2023 20:03:35 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m5-20020a7bce05000000b003ed1f6878a5sm8118830wmc.5.2023.04.15.20.03.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:35 -0700 (PDT) Message-Id: <07e5da241dc2cb6cf6cc6de1051a2ee490bf26c2.1681614206.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:13 +0000 Subject: [PATCH 11/23] versioncmp.h: move declarations for versioncmp.c functions from cache.h Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- cache.h | 2 -- ref-filter.c | 1 + versioncmp.c | 3 ++- versioncmp.h | 6 ++++++ 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 versioncmp.h diff --git a/cache.h b/cache.h index dde275c9301..6955745cccd 100644 --- a/cache.h +++ b/cache.h @@ -648,6 +648,4 @@ int stat_validity_check(struct stat_validity *sv, const char *path); */ void stat_validity_update(struct stat_validity *sv, int fd); -int versioncmp(const char *s1, const char *s2); - #endif /* CACHE_H */ diff --git a/ref-filter.c b/ref-filter.c index 57a5884aec7..5387f79be6d 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -19,6 +19,7 @@ #include "revision.h" #include "utf8.h" #include "version.h" +#include "versioncmp.h" #include "trailer.h" #include "wt-status.h" #include "commit-slab.h" diff --git a/versioncmp.c b/versioncmp.c index 069ee94a4d7..9b21ec142dd 100644 --- a/versioncmp.c +++ b/versioncmp.c @@ -1,6 +1,7 @@ -#include "cache.h" +#include "git-compat-util.h" #include "config.h" #include "string-list.h" +#include "versioncmp.h" /* * versioncmp(): copied from string/strverscmp.c in glibc commit diff --git a/versioncmp.h b/versioncmp.h new file mode 100644 index 00000000000..879b510e82a --- /dev/null +++ b/versioncmp.h @@ -0,0 +1,6 @@ +#ifndef VERSIONCMP_H +#define VERSIONCMP_H + +int versioncmp(const char *s1, const char *s2); + +#endif /* VERSIONCMP_H */ From patchwork Sun Apr 16 03:03:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212689 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 755CBC77B71 for ; Sun, 16 Apr 2023 03:04:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230161AbjDPDEM (ORCPT ); Sat, 15 Apr 2023 23:04:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230128AbjDPDDv (ORCPT ); Sat, 15 Apr 2023 23:03:51 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82A0F269E for ; Sat, 15 Apr 2023 20:03:37 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-2eed43bfa4bso653353f8f.2 for ; Sat, 15 Apr 2023 20:03:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614216; x=1684206216; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=tjrl8Oed5rjHg5PtrqFWFgcxhLHnyHcgNOXFVIVvWtE=; b=Rj54CQ+r5nkjDY7M7qhkDDvY3ILxiwleDB1JyLp3sH2Suj6lqs3T22LkMlb5mXd4Mk +gwKfQPUNooBUaQ83LLbFDY+8hg3Zh+7DvhWSOGu1G07nf/6peyqWIVGDn2mokCOTzdW NpqB75yMV68OAmHAaB1XFjW6aFh0zjLWyrb2xlgEanqNUCgVipYI7mYiL36uGc2KEL5t E45JTE64aVFYpD8/qDzKAnoYd0iJO7zQLB04ndl2SEdZACoPcsqTverkWZDBaW9FuqLK mrIMj3asiTDjsFV33mvugjo6hQcSvRqMgxFF0JSrozhzHv7VPNjVfQ9NRPe3RvEVm6Eq z33A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614216; x=1684206216; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tjrl8Oed5rjHg5PtrqFWFgcxhLHnyHcgNOXFVIVvWtE=; b=UcWtn6Al0lyA7/Ijwfr9tz4GUQAAUcKdMpSdBq6IcfKB07rUioH7MNmLnB42m+UBMw XWK6iqTuEHHZiXN40t5RSqekENYgLC9O6Y6MX5DDnMZicffaqP2zfmlhofPrDdQxT1zy uDA/fKETyPh6deO4SDfnc6jZ4ys2i1O5knQBdApoGOaU8FfDVlQS48JdFd9x1Hya/VDi OTV5HDAAYzCUOKeJl0vIWzY7I7ptvap6gDhdoLLZ+efwSUr0XhW/rrZ62a7yIeXaioa9 95EKC8SxVZ3FwVVePPw4YaBv6VxHp25Q/aS0cNT5QjKe7U6qgSrSiNMckdiUDTDTFjKT W7kQ== X-Gm-Message-State: AAQBX9cYJ+dK2EIkBpLCNHF7TmxOMPXZLBd6VEZhRezn4CWsbTx15p22 8mv0t+D2PZfUlRBatYN6/TJgqJzB9iU= X-Google-Smtp-Source: AKy350YJp4RPiQo4vI0etNJ3c5q3u921VumrzeYO7LC3/94/NnTBVK44uW9SvWiGtr0XVyK5Hu7TiA== X-Received: by 2002:a5d:63c3:0:b0:2f9:61b5:7796 with SMTP id c3-20020a5d63c3000000b002f961b57796mr779401wrw.29.1681614215900; Sat, 15 Apr 2023 20:03:35 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id g6-20020a056000118600b002f0057f6fd8sm7026305wrx.13.2023.04.15.20.03.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:35 -0700 (PDT) Message-Id: <4c951a53737efec1f4da866a80955b4c34f5e5f4.1681614206.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:14 +0000 Subject: [PATCH 12/23] dir.h: move DTYPE defines from cache.h Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- cache.h | 14 -------------- dir.h | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/cache.h b/cache.h index 6955745cccd..ad741e70bc2 100644 --- a/cache.h +++ b/cache.h @@ -10,20 +10,6 @@ #include "object.h" #include "statinfo.h" -#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT) -#define DTYPE(de) ((de)->d_type) -#else -#undef DT_UNKNOWN -#undef DT_DIR -#undef DT_REG -#undef DT_LNK -#define DT_UNKNOWN 0 -#define DT_DIR 1 -#define DT_REG 2 -#define DT_LNK 3 -#define DTYPE(de) DT_UNKNOWN -#endif - /* * Some mode bits are also used internally for computations. * diff --git a/dir.h b/dir.h index 3d6c87387e9..79b85a01ee4 100644 --- a/dir.h +++ b/dir.h @@ -640,4 +640,19 @@ static inline int starts_with_dot_dot_slash_native(const char *const path) return path_match_flags(path, what | PATH_MATCH_NATIVE); } + +#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT) +#define DTYPE(de) ((de)->d_type) +#else +#undef DT_UNKNOWN +#undef DT_DIR +#undef DT_REG +#undef DT_LNK +#define DT_UNKNOWN 0 +#define DT_DIR 1 +#define DT_REG 2 +#define DT_LNK 3 +#define DTYPE(de) DT_UNKNOWN +#endif + #endif From patchwork Sun Apr 16 03:03:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212693 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 575A3C77B71 for ; Sun, 16 Apr 2023 03:04:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230160AbjDPDE0 (ORCPT ); Sat, 15 Apr 2023 23:04:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230143AbjDPDDw (ORCPT ); Sat, 15 Apr 2023 23:03:52 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56FD43582 for ; Sat, 15 Apr 2023 20:03:38 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-2eff1a664e7so358694f8f.2 for ; Sat, 15 Apr 2023 20:03:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614216; x=1684206216; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=vDWtoW7uRNtarKiJCmmSWv4JVqFWGBFgex4Uw8z0ogI=; b=pB2V4YHGyM+UXoS4j7SdrnJMoYA9PKWUHASr7FkJDtyfOV2BNSC26BpDNN5Vy1dtaA wL5qWbRkz9UpQ19NVjH3mgC6OxW58eMv9lQBXFFqcs3neOHhFIh1WgJs55aaXqnxFM5W yrpgLFTLRVbYNWNiduL74OEQRspwwZPA+k1RF8qvySq/DeNNCn3GgoS0GBmOSosse0Yo 9C+SyZRzsELCezGWvvoxdbymoRi6Xlx8rs+j961gxePocyIa1E82G21ppv79+02i7oqJ nKo+MlbBVGFj4WQD3ENQzWa/LTyALenGK59DezJZ2g+SVtXn2HuMRJdIn3acAWOFa2Fj hWmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614216; x=1684206216; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vDWtoW7uRNtarKiJCmmSWv4JVqFWGBFgex4Uw8z0ogI=; b=W3qgVWXBKMvCxFKt2XLaD4PFq2RcIfOjxzhEXfnU0f6RwAe3DCVpkuN4FATe/AH1KX Ndex+9ZFhDllOKK3OfbwY669vViayZo4jM0aV1CNYJa/fIB7r+lsoUPXeDAflO+YrQJn i/Ax8GY3w4TgyuQdQGg9Mf/DQNjB/szbCHbn3QxIj0UNAQuQ5NuAUCeuLoL4Fy/5TvNo YPWL4SNeiNwT+EBqRGQkdkiES8M0YbObVT15RRoDT0MXuTDpYPZ4nje9NdR5gvGAaAbf Rb/+RLAZ0dzpxy0SXjUabjXwJ4FEjV2qG28rp5TSjhySO7T0IlDeHsi4WHAFl8dy5ieI /0jA== X-Gm-Message-State: AAQBX9excRNulkbTMpNeFwow4pWwt9z9BDTNfNXMMl2cjx/nTnYWOL7y WxhDoagkWbRMpuWR3W0LHplXbXqwzVc= X-Google-Smtp-Source: AKy350ZUFlA4QOBxsnSsRLqIjZF1V8fD/fw6qXxSm58QVJAjkzpK15uNQwoo7+KutkQX+Ax/PFTMrw== X-Received: by 2002:a5d:564a:0:b0:2f4:a60f:3cd8 with SMTP id j10-20020a5d564a000000b002f4a60f3cd8mr2876589wrw.49.1681614216544; Sat, 15 Apr 2023 20:03:36 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m4-20020a5d6a04000000b002f0442a2d3asm6998392wru.48.2023.04.15.20.03.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:36 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:15 +0000 Subject: [PATCH 13/23] tree-diff.c: move S_DIFFTREE_IFXMIN_NEQ define from cache.h Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren S_DIFFTREE_IFXMIN_NEQ is *only* used in tree-diff.c, so there is no point exposing it in cache.h. Move it to tree-diff.c. Signed-off-by: Elijah Newren --- cache.h | 15 --------------- tree-diff.c | 13 +++++++++++++ 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/cache.h b/cache.h index ad741e70bc2..7a46f300d9b 100644 --- a/cache.h +++ b/cache.h @@ -10,21 +10,6 @@ #include "object.h" #include "statinfo.h" -/* - * Some mode bits are also used internally for computations. - * - * They *must* not overlap with any valid modes, and they *must* not be emitted - * to outside world - i.e. appear on disk or network. In other words, it's just - * temporary fields, which we internally use, but they have to stay in-house. - * - * ( such approach is valid, as standard S_IF* fits into 16 bits, and in Git - * codebase mode is `unsigned int` which is assumed to be at least 32 bits ) - */ - -/* used internally in tree-diff */ -#define S_DIFFTREE_IFXMIN_NEQ 0x80000000 - - /* * Basic data structures for the directory cache */ diff --git a/tree-diff.c b/tree-diff.c index 69031d7cbae..a76e6dae619 100644 --- a/tree-diff.c +++ b/tree-diff.c @@ -6,6 +6,19 @@ #include "diffcore.h" #include "tree.h" +/* + * Some mode bits are also used internally for computations. + * + * They *must* not overlap with any valid modes, and they *must* not be emitted + * to outside world - i.e. appear on disk or network. In other words, it's just + * temporary fields, which we internally use, but they have to stay in-house. + * + * ( such approach is valid, as standard S_IF* fits into 16 bits, and in Git + * codebase mode is `unsigned int` which is assumed to be at least 32 bits ) + */ + +#define S_DIFFTREE_IFXMIN_NEQ 0x80000000 + /* * internal mode marker, saying a tree entry != entry of tp[imin] * (see ll_diff_tree_paths for what it means there) From patchwork Sun Apr 16 03:03:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212697 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80C14C77B70 for ; Sun, 16 Apr 2023 03:04:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230258AbjDPDEe (ORCPT ); Sat, 15 Apr 2023 23:04:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230147AbjDPDEF (ORCPT ); Sat, 15 Apr 2023 23:04:05 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 526C430D5 for ; Sat, 15 Apr 2023 20:03:38 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id k36-20020a05600c1ca400b003f0a7c483feso4537879wms.4 for ; Sat, 15 Apr 2023 20:03:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614217; x=1684206217; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=f6NNGlJEe2TotaQHd0hl2bQCb+Ey6Zeu8Wp96LrX8oQ=; b=lGaTUMHPTvxwoXFUbElMPKklBJ9mlfoiMl9mox/cSauUzpgsTN6AF6iWotm6qGMsq1 VNO0TFqRU8US9YqCRj4NQulN0C3gJay338aBnU5cxUoYka++RS95N7Ce+56QtuYTsx2E 34UrcO33xc/lc4qutkcdZZYr7OAL8f0ovxjY5N6iO+T4d7c7ghCRlITl+mFBLNHGjvnJ m4XzlQtbb0h+5ISSSfuJyDqvGsycpIrJtR28aL3qbjE1nvUAKy1yM+R0eqTEr/Efwe9/ hJS6TIscpAc9HHSRC1uc4e48Dc5TxaFfn4w5/f2VtfPNjJT/Ac0FOr7hCNez8sloFCsD Oavg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614217; x=1684206217; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f6NNGlJEe2TotaQHd0hl2bQCb+Ey6Zeu8Wp96LrX8oQ=; b=g2ulfxyJQvklObh0wTfwcXL/oHfY/ocTqnRWKJnUcdLsk47S+h3Q2ChaI7DdVO04tT bBJN9kgf3qHVQxcNnZrGx44lkpfh54dghnE7uG25T4yMuNQCZTxAY01IX5/o1kl3NNK4 nzMWxHMe4oJxaQAVgqm4Ao6lKys03Gz26T/xRRnd0ie6rPeMVGdCRUHBE77Ia+CZBctG 9eAvED3nBSl4QZYFJ9AW6Eds9i0RJb9N+w/pVmZQP2vgJGjZBoO28ktJIwGt26YF1rW2 pChIIxV/ZwO4QysB1jzyxSIICmtT/FntEI5mZNUHuKxZ4WIQC0LlE5MTlL7LkLy35RMY VrdQ== X-Gm-Message-State: AAQBX9dEnUz8m1hdl1RBTW4ljsznrUAF1pgB7TL8R/NO7TmVjDRtin79 9uOaTZXnQObEfdu8R0Q5s0uqeMghnRQ= X-Google-Smtp-Source: AKy350ZO4ekd8AHmCwR5/q6MI4TtHYtAtGa5Cp+tyXbH4JdIo2byM4K013yUaCmBGSFlSF0YuTyKQg== X-Received: by 2002:a05:600c:249:b0:3f0:a1df:ada9 with SMTP id 9-20020a05600c024900b003f0a1dfada9mr7367009wmj.39.1681614217295; Sat, 15 Apr 2023 20:03:37 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 7-20020a05600c028700b003f09a9503b5sm8075443wmk.23.2023.04.15.20.03.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:36 -0700 (PDT) Message-Id: <1c6989ae456c86850761b079384f1505735e317a.1681614206.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:16 +0000 Subject: [PATCH 14/23] hash.h, repository.h: reverse the order of these dependencies Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Previously, hash.h depended upon and included repository.h, due to the definition and use of the_hash_algo (defined as the_repository->hash_algo). Move this #define, and the associated inline functions that depend upon it, from hash.h to repository.h. Due to that movement, reverse the dependencies so repository.h includes hash.h. This allows hash.h and object.h to be fairly small, minimal headers. It also exposes a lot of hidden dependencies on both path.h (which was brought in by repository.h) and repository.h (which was previously implicitly brought in by object.h). Signed-off-by: Elijah Newren --- alloc.c | 1 + branch.c | 1 + builtin/apply.c | 1 + builtin/archive.c | 1 + builtin/bundle.c | 1 + builtin/check-attr.c | 1 + builtin/check-ignore.c | 1 + builtin/checkout-index.c | 1 + builtin/clean.c | 1 + builtin/config.c | 1 + builtin/credential-cache.c | 1 + builtin/credential-store.c | 1 + builtin/for-each-repo.c | 2 + builtin/help.c | 1 + builtin/init-db.c | 1 + builtin/merge-index.c | 1 + builtin/merge-recursive.c | 1 + builtin/mv.c | 1 + builtin/push.c | 1 + builtin/read-tree.c | 1 + builtin/rerere.c | 1 + builtin/rm.c | 1 + builtin/show-branch.c | 1 + builtin/show-index.c | 1 + builtin/update-index.c | 1 + builtin/update-ref.c | 1 + builtin/upload-archive.c | 1 + builtin/worktree.c | 1 + checkout.c | 1 + chunk-format.c | 1 + common-main.c | 1 + compat/fsmonitor/fsm-ipc-darwin.c | 1 + compat/fsmonitor/fsm-ipc-win32.c | 1 + compat/precompose_utf8.c | 1 + compat/win32/trace2_win32_process_info.c | 1 + copy.c | 1 + csum-file.c | 1 + daemon.c | 1 + editor.c | 1 + exec-cmd.c | 1 + fsmonitor-ipc.c | 1 + gpg-interface.c | 1 + hash-lookup.c | 1 + hash.h | 97 -------------------- hex.c | 1 + hook.c | 1 + khash.h | 1 + merge-ort-wrappers.c | 1 + negotiator/default.c | 1 + negotiator/skipping.c | 1 + object-file.h | 2 + object.h | 1 + oid-array.h | 1 + oidmap.c | 1 + oidtree.c | 1 + parallel-checkout.c | 1 + pathspec.c | 1 + progress.c | 1 + rebase-interactive.c | 1 + refs/files-backend.c | 1 + refs/packed-backend.c | 1 + refs/ref-cache.c | 1 + refs/ref-cache.h | 1 + refspec.c | 1 + repository.h | 96 +++++++++++++++++++ resolve-undo.c | 1 + split-index.c | 1 + strbuf.c | 1 + t/helper/test-bloom.c | 1 + t/helper/test-cache-tree.c | 1 + t/helper/test-dump-cache-tree.c | 1 + t/helper/test-dump-fsmonitor.c | 1 + t/helper/test-dump-untracked-cache.c | 1 + t/helper/test-example-decorate.c | 1 + t/helper/test-fsmonitor-client.c | 1 + t/helper/test-lazy-init-name-hash.c | 1 + t/helper/test-match-trees.c | 1 + t/helper/test-oidmap.c | 1 + t/helper/test-path-utils.c | 1 + t/helper/test-read-cache.c | 1 + t/helper/test-scrap-cache-tree.c | 1 + t/helper/test-submodule-config.c | 1 + t/helper/test-submodule-nested-repo-config.c | 1 + t/helper/test-submodule.c | 1 + t/helper/test-trace2.c | 1 + t/helper/test-write-cache.c | 1 + trace2.c | 1 + trace2/tr2_tgt_event.c | 1 + trace2/tr2_tgt_normal.c | 1 + trace2/tr2_tgt_perf.c | 1 + tree-walk.h | 1 + tree.h | 1 + wrapper.c | 1 + 93 files changed, 189 insertions(+), 97 deletions(-) diff --git a/alloc.c b/alloc.c index 2886aa93543..377e80f5dda 100644 --- a/alloc.c +++ b/alloc.c @@ -13,6 +13,7 @@ #include "blob.h" #include "tree.h" #include "commit.h" +#include "repository.h" #include "tag.h" #include "alloc.h" diff --git a/branch.c b/branch.c index 7df982693af..9415ee3f340 100644 --- a/branch.c +++ b/branch.c @@ -9,6 +9,7 @@ #include "refs.h" #include "refspec.h" #include "remote.h" +#include "repository.h" #include "sequencer.h" #include "commit.h" #include "worktree.h" diff --git a/builtin/apply.c b/builtin/apply.c index fe72c0ec3eb..e3ff02a09e3 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -2,6 +2,7 @@ #include "builtin.h" #include "gettext.h" #include "parse-options.h" +#include "repository.h" #include "apply.h" static const char * const apply_usage[] = { diff --git a/builtin/archive.c b/builtin/archive.c index d13934f1a80..b0eaa3c14a3 100644 --- a/builtin/archive.c +++ b/builtin/archive.c @@ -9,6 +9,7 @@ #include "transport.h" #include "parse-options.h" #include "pkt-line.h" +#include "repository.h" #include "sideband.h" static void create_output_file(const char *output_file) diff --git a/builtin/bundle.c b/builtin/bundle.c index 584d905d965..44113389d7a 100644 --- a/builtin/bundle.c +++ b/builtin/bundle.c @@ -5,6 +5,7 @@ #include "strvec.h" #include "parse-options.h" #include "pkt-line.h" +#include "repository.h" #include "cache.h" #include "bundle.h" diff --git a/builtin/check-attr.c b/builtin/check-attr.c index 037bf1aaa2a..b2b678847f5 100644 --- a/builtin/check-attr.c +++ b/builtin/check-attr.c @@ -7,6 +7,7 @@ #include "gettext.h" #include "object-name.h" #include "quote.h" +#include "repository.h" #include "setup.h" #include "parse-options.h" #include "write-or-die.h" diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c index 9401dad0070..e4b78782a32 100644 --- a/builtin/check-ignore.c +++ b/builtin/check-ignore.c @@ -7,6 +7,7 @@ #include "quote.h" #include "pathspec.h" #include "parse-options.h" +#include "repository.h" #include "submodule.h" #include "write-or-die.h" diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c index 7df673e3e70..9375a05539f 100644 --- a/builtin/checkout-index.c +++ b/builtin/checkout-index.c @@ -11,6 +11,7 @@ #include "gettext.h" #include "lockfile.h" #include "quote.h" +#include "repository.h" #include "cache-tree.h" #include "parse-options.h" #include "entry.h" diff --git a/builtin/clean.c b/builtin/clean.c index 14c0d555eac..78852d28cec 100644 --- a/builtin/clean.c +++ b/builtin/clean.c @@ -14,6 +14,7 @@ #include "dir.h" #include "gettext.h" #include "parse-options.h" +#include "repository.h" #include "setup.h" #include "string-list.h" #include "quote.h" diff --git a/builtin/config.c b/builtin/config.c index 9401f1e5e3b..7efcf2d2159 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -10,6 +10,7 @@ #include "parse-options.h" #include "urlmatch.h" #include "quote.h" +#include "repository.h" #include "setup.h" #include "worktree.h" #include "wrapper.h" diff --git a/builtin/credential-cache.c b/builtin/credential-cache.c index 508da4c6e4d..204e78ac772 100644 --- a/builtin/credential-cache.c +++ b/builtin/credential-cache.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "gettext.h" #include "parse-options.h" +#include "repository.h" #include "wrapper.h" #include "write-or-die.h" diff --git a/builtin/credential-store.c b/builtin/credential-store.c index 8977604eb9d..30c6ccf56c0 100644 --- a/builtin/credential-store.c +++ b/builtin/credential-store.c @@ -3,6 +3,7 @@ #include "gettext.h" #include "lockfile.h" #include "credential.h" +#include "path.h" #include "string-list.h" #include "parse-options.h" #include "write-or-die.h" diff --git a/builtin/for-each-repo.c b/builtin/for-each-repo.c index 27425c2fc9e..c28b0b3543a 100644 --- a/builtin/for-each-repo.c +++ b/builtin/for-each-repo.c @@ -3,6 +3,8 @@ #include "builtin.h" #include "gettext.h" #include "parse-options.h" +#include "path.h" +#include "repository.h" #include "run-command.h" #include "string-list.h" diff --git a/builtin/help.c b/builtin/help.c index 128aa83099a..d3cf4af3f6e 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -8,6 +8,7 @@ #include "gettext.h" #include "pager.h" #include "parse-options.h" +#include "path.h" #include "run-command.h" #include "config-list.h" #include "help.h" diff --git a/builtin/init-db.c b/builtin/init-db.c index cda6ee75eb5..aef40361052 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -14,6 +14,7 @@ #include "exec-cmd.h" #include "object-file.h" #include "parse-options.h" +#include "path.h" #include "setup.h" #include "worktree.h" #include "wrapper.h" diff --git a/builtin/merge-index.c b/builtin/merge-index.c index c875f5d37ee..f044382ed8f 100644 --- a/builtin/merge-index.c +++ b/builtin/merge-index.c @@ -1,6 +1,7 @@ #define USE_THE_INDEX_VARIABLE #include "builtin.h" #include "hex.h" +#include "repository.h" #include "run-command.h" static const char *pgm; diff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c index fa1035405c3..eae25c9486e 100644 --- a/builtin/merge-recursive.c +++ b/builtin/merge-recursive.c @@ -6,6 +6,7 @@ #include "tag.h" #include "merge-recursive.h" #include "object-name.h" +#include "repository.h" #include "xdiff-interface.h" static const char builtin_merge_recursive_usage[] = diff --git a/builtin/mv.c b/builtin/mv.c index 32935af48e6..665bd274485 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -18,6 +18,7 @@ #include "cache-tree.h" #include "string-list.h" #include "parse-options.h" +#include "repository.h" #include "setup.h" #include "submodule.h" #include "entry.h" diff --git a/builtin/push.c b/builtin/push.c index 7d2b0505aac..4e5780dd50d 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -15,6 +15,7 @@ #include "transport.h" #include "parse-options.h" #include "pkt-line.h" +#include "repository.h" #include "submodule.h" #include "submodule-config.h" #include "send-pack.h" diff --git a/builtin/read-tree.c b/builtin/read-tree.c index d61cbad96de..440f19b1b87 100644 --- a/builtin/read-tree.c +++ b/builtin/read-tree.c @@ -19,6 +19,7 @@ #include "dir.h" #include "builtin.h" #include "parse-options.h" +#include "repository.h" #include "resolve-undo.h" #include "setup.h" #include "submodule.h" diff --git a/builtin/rerere.c b/builtin/rerere.c index d4a03707b1a..d4bd52797f4 100644 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@ -4,6 +4,7 @@ #include "dir.h" #include "gettext.h" #include "parse-options.h" +#include "repository.h" #include "string-list.h" #include "rerere.h" #include "wrapper.h" diff --git a/builtin/rm.c b/builtin/rm.c index d36072252e7..ccbce94d07d 100644 --- a/builtin/rm.c +++ b/builtin/rm.c @@ -15,6 +15,7 @@ #include "tree-walk.h" #include "object-name.h" #include "parse-options.h" +#include "repository.h" #include "string-list.h" #include "setup.h" #include "submodule.h" diff --git a/builtin/show-branch.c b/builtin/show-branch.c index 20030b75e39..04167b14060 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -10,6 +10,7 @@ #include "strvec.h" #include "object-name.h" #include "parse-options.h" +#include "repository.h" #include "dir.h" #include "commit-slab.h" #include "date.h" diff --git a/builtin/show-index.c b/builtin/show-index.c index d4bbbbcd6ce..6608b5d252e 100644 --- a/builtin/show-index.c +++ b/builtin/show-index.c @@ -4,6 +4,7 @@ #include "hex.h" #include "pack.h" #include "parse-options.h" +#include "repository.h" static const char *const show_index_usage[] = { "git show-index [--object-format=]", diff --git a/builtin/update-index.c b/builtin/update-index.c index 58bbc80db77..df36bc0a42d 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -21,6 +21,7 @@ #include "parse-options.h" #include "pathspec.h" #include "dir.h" +#include "repository.h" #include "setup.h" #include "split-index.h" #include "symlinks.h" diff --git a/builtin/update-ref.c b/builtin/update-ref.c index 6ca85420c3b..ef1fcb86718 100644 --- a/builtin/update-ref.c +++ b/builtin/update-ref.c @@ -6,6 +6,7 @@ #include "object-name.h" #include "parse-options.h" #include "quote.h" +#include "repository.h" #include "strvec.h" static const char * const git_update_ref_usage[] = { diff --git a/builtin/upload-archive.c b/builtin/upload-archive.c index 945ee2b4126..5be97ca1af5 100644 --- a/builtin/upload-archive.c +++ b/builtin/upload-archive.c @@ -6,6 +6,7 @@ #include "archive.h" #include "pkt-line.h" #include "sideband.h" +#include "repository.h" #include "run-command.h" #include "strvec.h" diff --git a/builtin/worktree.c b/builtin/worktree.c index 0b411e9deee..5d3ca819e76 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -14,6 +14,7 @@ #include "strvec.h" #include "branch.h" #include "refs.h" +#include "repository.h" #include "run-command.h" #include "hook.h" #include "sigchain.h" diff --git a/checkout.c b/checkout.c index 04238b27133..4256e71a7c4 100644 --- a/checkout.c +++ b/checkout.c @@ -2,6 +2,7 @@ #include "object-name.h" #include "remote.h" #include "refspec.h" +#include "repository.h" #include "checkout.h" #include "config.h" #include "strbuf.h" diff --git a/chunk-format.c b/chunk-format.c index 60a73c1b140..6bd87b7de89 100644 --- a/chunk-format.c +++ b/chunk-format.c @@ -3,6 +3,7 @@ #include "chunk-format.h" #include "csum-file.h" #include "gettext.h" +#include "repository.h" #include "trace2.h" /* diff --git a/common-main.c b/common-main.c index 601a875e2fb..8ab50fa37a4 100644 --- a/common-main.c +++ b/common-main.c @@ -2,6 +2,7 @@ #include "exec-cmd.h" #include "gettext.h" #include "attr.h" +#include "repository.h" #include "setup.h" #include "strbuf.h" #include "trace2.h" diff --git a/compat/fsmonitor/fsm-ipc-darwin.c b/compat/fsmonitor/fsm-ipc-darwin.c index eb25123fa12..e62f093cc19 100644 --- a/compat/fsmonitor/fsm-ipc-darwin.c +++ b/compat/fsmonitor/fsm-ipc-darwin.c @@ -1,6 +1,7 @@ #include "cache.h" #include "config.h" #include "hex.h" +#include "repository.h" #include "strbuf.h" #include "fsmonitor.h" #include "fsmonitor-ipc.h" diff --git a/compat/fsmonitor/fsm-ipc-win32.c b/compat/fsmonitor/fsm-ipc-win32.c index c9536dfb666..8928fa93ce2 100644 --- a/compat/fsmonitor/fsm-ipc-win32.c +++ b/compat/fsmonitor/fsm-ipc-win32.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "config.h" #include "fsmonitor-ipc.h" +#include "path.h" const char *fsmonitor_ipc__get_path(struct repository *r) { static char *ret; diff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c index 8a9881db077..a4d11376ba5 100644 --- a/compat/precompose_utf8.c +++ b/compat/precompose_utf8.c @@ -9,6 +9,7 @@ #include "config.h" #include "environment.h" #include "gettext.h" +#include "path.h" #include "utf8.h" #include "precompose_utf8.h" diff --git a/compat/win32/trace2_win32_process_info.c b/compat/win32/trace2_win32_process_info.c index e3e895c78a2..a4e33768f43 100644 --- a/compat/win32/trace2_win32_process_info.c +++ b/compat/win32/trace2_win32_process_info.c @@ -1,5 +1,6 @@ #include "../../cache.h" #include "../../json-writer.h" +#include "../../repository.h" #include "../../trace2.h" #include "lazyload.h" #include diff --git a/copy.c b/copy.c index db6b615c188..923d8a6dc61 100644 --- a/copy.c +++ b/copy.c @@ -1,5 +1,6 @@ #include "cache.h" #include "copy.h" +#include "path.h" #include "wrapper.h" int copy_fd(int ifd, int ofd) diff --git a/csum-file.c b/csum-file.c index 82ae2973d30..2d14b76c533 100644 --- a/csum-file.c +++ b/csum-file.c @@ -10,6 +10,7 @@ #include "git-compat-util.h" #include "progress.h" #include "csum-file.h" +#include "repository.h" #include "wrapper.h" static void verify_buffer_or_die(struct hashfile *f, diff --git a/daemon.c b/daemon.c index 75c3c064574..f89f99d7ef4 100644 --- a/daemon.c +++ b/daemon.c @@ -3,6 +3,7 @@ #include "alloc.h" #include "config.h" #include "environment.h" +#include "path.h" #include "pkt-line.h" #include "protocol.h" #include "run-command.h" diff --git a/editor.c b/editor.c index b34e10606d2..38c5dbbb79b 100644 --- a/editor.c +++ b/editor.c @@ -6,6 +6,7 @@ #include "environment.h" #include "gettext.h" #include "pager.h" +#include "path.h" #include "strbuf.h" #include "strvec.h" #include "run-command.h" diff --git a/exec-cmd.c b/exec-cmd.c index 6f618463896..1e34e48c0e4 100644 --- a/exec-cmd.c +++ b/exec-cmd.c @@ -3,6 +3,7 @@ #include "environment.h" #include "exec-cmd.h" #include "gettext.h" +#include "path.h" #include "quote.h" #include "strvec.h" #include "trace.h" diff --git a/fsmonitor-ipc.c b/fsmonitor-ipc.c index 866828e2992..6a6a89764a6 100644 --- a/fsmonitor-ipc.c +++ b/fsmonitor-ipc.c @@ -3,6 +3,7 @@ #include "gettext.h" #include "simple-ipc.h" #include "fsmonitor-ipc.h" +#include "repository.h" #include "run-command.h" #include "strbuf.h" #include "trace2.h" diff --git a/gpg-interface.c b/gpg-interface.c index aceeb083367..8615dcd4b4b 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -7,6 +7,7 @@ #include "dir.h" #include "ident.h" #include "gpg-interface.h" +#include "path.h" #include "sigchain.h" #include "tempfile.h" #include "alias.h" diff --git a/hash-lookup.c b/hash-lookup.c index b98ed5e11e8..68cf6d03bf3 100644 --- a/hash-lookup.c +++ b/hash-lookup.c @@ -1,5 +1,6 @@ #include "cache.h" #include "hash-lookup.h" +#include "repository.h" static uint32_t take2(const struct object_id *oid, size_t ofs) { diff --git a/hash.h b/hash.h index d39f73618cb..ed963816289 100644 --- a/hash.h +++ b/hash.h @@ -1,8 +1,6 @@ #ifndef HASH_H #define HASH_H -#include "repository.h" - #if defined(SHA1_APPLE) #include #elif defined(SHA1_OPENSSL) @@ -230,8 +228,6 @@ static inline int hash_algo_by_ptr(const struct git_hash_algo *p) return p - hash_algos; } -#define the_hash_algo the_repository->hash_algo - const struct object_id *null_oid(void); static inline int hashcmp_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop) @@ -245,21 +241,6 @@ static inline int hashcmp_algop(const unsigned char *sha1, const unsigned char * return memcmp(sha1, sha2, GIT_SHA1_RAWSZ); } -static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2) -{ - return hashcmp_algop(sha1, sha2, the_hash_algo); -} - -static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2) -{ - const struct git_hash_algo *algop; - if (!oid1->algo) - algop = the_hash_algo; - else - algop = &hash_algos[oid1->algo]; - return hashcmp_algop(oid1->hash, oid2->hash, algop); -} - static inline int hasheq_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop) { /* @@ -271,53 +252,12 @@ static inline int hasheq_algop(const unsigned char *sha1, const unsigned char *s return !memcmp(sha1, sha2, GIT_SHA1_RAWSZ); } -static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2) -{ - return hasheq_algop(sha1, sha2, the_hash_algo); -} - -static inline int oideq(const struct object_id *oid1, const struct object_id *oid2) -{ - const struct git_hash_algo *algop; - if (!oid1->algo) - algop = the_hash_algo; - else - algop = &hash_algos[oid1->algo]; - return hasheq_algop(oid1->hash, oid2->hash, algop); -} - -static inline int is_null_oid(const struct object_id *oid) -{ - return oideq(oid, null_oid()); -} - -static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src) -{ - memcpy(sha_dst, sha_src, the_hash_algo->rawsz); -} - static inline void oidcpy(struct object_id *dst, const struct object_id *src) { memcpy(dst->hash, src->hash, GIT_MAX_RAWSZ); dst->algo = src->algo; } -/* Like oidcpy() but zero-pads the unused bytes in dst's hash array. */ -static inline void oidcpy_with_padding(struct object_id *dst, - const struct object_id *src) -{ - size_t hashsz; - - if (!src->algo) - hashsz = the_hash_algo->rawsz; - else - hashsz = hash_algos[src->algo].rawsz; - - memcpy(dst->hash, src->hash, hashsz); - memset(dst->hash + hashsz, 0, GIT_MAX_RAWSZ - hashsz); - dst->algo = src->algo; -} - static inline struct object_id *oiddup(const struct object_id *src) { struct object_id *dst = xmalloc(sizeof(struct object_id)); @@ -325,43 +265,6 @@ static inline struct object_id *oiddup(const struct object_id *src) return dst; } -static inline void hashclr(unsigned char *hash) -{ - memset(hash, 0, the_hash_algo->rawsz); -} - -static inline void oidclr(struct object_id *oid) -{ - memset(oid->hash, 0, GIT_MAX_RAWSZ); - oid->algo = hash_algo_by_ptr(the_hash_algo); -} - -static inline void oidread(struct object_id *oid, const unsigned char *hash) -{ - memcpy(oid->hash, hash, the_hash_algo->rawsz); - oid->algo = hash_algo_by_ptr(the_hash_algo); -} - -static inline int is_empty_blob_sha1(const unsigned char *sha1) -{ - return hasheq(sha1, the_hash_algo->empty_blob->hash); -} - -static inline int is_empty_blob_oid(const struct object_id *oid) -{ - return oideq(oid, the_hash_algo->empty_blob); -} - -static inline int is_empty_tree_sha1(const unsigned char *sha1) -{ - return hasheq(sha1, the_hash_algo->empty_tree->hash); -} - -static inline int is_empty_tree_oid(const struct object_id *oid) -{ - return oideq(oid, the_hash_algo->empty_tree); -} - static inline void oid_set_algo(struct object_id *oid, const struct git_hash_algo *algop) { oid->algo = hash_algo_by_ptr(algop); diff --git a/hex.c b/hex.c index 0a1bddc1284..f6849b51b28 100644 --- a/hex.c +++ b/hex.c @@ -1,5 +1,6 @@ #include "git-compat-util.h" #include "hex.h" +#include "repository.h" const signed char hexval_table[256] = { -1, -1, -1, -1, -1, -1, -1, -1, /* 00-07 */ diff --git a/hook.c b/hook.c index 76e322f5804..3ca5e60895d 100644 --- a/hook.c +++ b/hook.c @@ -2,6 +2,7 @@ #include "advice.h" #include "gettext.h" #include "hook.h" +#include "path.h" #include "run-command.h" #include "config.h" #include "strbuf.h" diff --git a/khash.h b/khash.h index 85362718c56..edd5b45d000 100644 --- a/khash.h +++ b/khash.h @@ -27,6 +27,7 @@ #define __AC_KHASH_H #include "hashmap.h" +#include "repository.h" #define AC_VERSION_KHASH_H "0.2.8" diff --git a/merge-ort-wrappers.c b/merge-ort-wrappers.c index c00dfbab1cd..2d1e8aa7ee7 100644 --- a/merge-ort-wrappers.c +++ b/merge-ort-wrappers.c @@ -2,6 +2,7 @@ #include "gettext.h" #include "merge-ort.h" #include "merge-ort-wrappers.h" +#include "repository.h" #include "commit.h" diff --git a/negotiator/default.c b/negotiator/default.c index f4b78eb47dd..5cb2b1d2046 100644 --- a/negotiator/default.c +++ b/negotiator/default.c @@ -4,6 +4,7 @@ #include "../fetch-negotiator.h" #include "../prio-queue.h" #include "../refs.h" +#include "../repository.h" #include "../tag.h" /* Remember to update object flag allocation in object.h */ diff --git a/negotiator/skipping.c b/negotiator/skipping.c index c7d6ab39bc5..97e7e1ae725 100644 --- a/negotiator/skipping.c +++ b/negotiator/skipping.c @@ -5,6 +5,7 @@ #include "../hex.h" #include "../prio-queue.h" #include "../refs.h" +#include "../repository.h" #include "../tag.h" /* Remember to update object flag allocation in object.h */ diff --git a/object-file.h b/object-file.h index e0cfc3a5db8..d6414610f80 100644 --- a/object-file.h +++ b/object-file.h @@ -4,6 +4,8 @@ #include "git-zlib.h" #include "object.h" +struct index_state; + /* * Set this to 0 to prevent oid_object_info_extended() from fetching missing * blobs. This has a difference only if extensions.partialClone is set. diff --git a/object.h b/object.h index 96e52e24fb1..6cd8b49fa66 100644 --- a/object.h +++ b/object.h @@ -4,6 +4,7 @@ #include "hash.h" struct buffer_slab; +struct repository; struct parsed_object_pool { struct object **obj_hash; diff --git a/oid-array.h b/oid-array.h index f60f9af6741..8bfe452259b 100644 --- a/oid-array.h +++ b/oid-array.h @@ -2,6 +2,7 @@ #define OID_ARRAY_H #include "hash.h" +#include "repository.h" /** * The API provides storage and manipulation of sets of object identifiers. diff --git a/oidmap.c b/oidmap.c index 8c1a139c974..d268486f4e8 100644 --- a/oidmap.c +++ b/oidmap.c @@ -1,5 +1,6 @@ #include "git-compat-util.h" #include "oidmap.h" +#include "repository.h" static int oidmap_neq(const void *hashmap_cmp_fn_data UNUSED, const struct hashmap_entry *e1, diff --git a/oidtree.c b/oidtree.c index 7d57b7b19e3..634214673dd 100644 --- a/oidtree.c +++ b/oidtree.c @@ -6,6 +6,7 @@ #include "oidtree.h" #include "alloc.h" #include "hash.h" +#include "repository.h" struct oidtree_iter_data { oidtree_iter fn; diff --git a/parallel-checkout.c b/parallel-checkout.c index 7f0569cc930..78cb6e3003a 100644 --- a/parallel-checkout.c +++ b/parallel-checkout.c @@ -7,6 +7,7 @@ #include "parallel-checkout.h" #include "pkt-line.h" #include "progress.h" +#include "repository.h" #include "run-command.h" #include "sigchain.h" #include "streaming.h" diff --git a/pathspec.c b/pathspec.c index ec335a214e2..1e57b6c667d 100644 --- a/pathspec.c +++ b/pathspec.c @@ -6,6 +6,7 @@ #include "gettext.h" #include "pathspec.h" #include "attr.h" +#include "repository.h" #include "setup.h" #include "strvec.h" #include "symlinks.h" diff --git a/progress.c b/progress.c index 72d5e0c73c1..f695798acac 100644 --- a/progress.c +++ b/progress.c @@ -12,6 +12,7 @@ #include "git-compat-util.h" #include "pager.h" #include "progress.h" +#include "repository.h" #include "strbuf.h" #include "trace.h" #include "trace2.h" diff --git a/rebase-interactive.c b/rebase-interactive.c index 789f4073617..852a3313182 100644 --- a/rebase-interactive.c +++ b/rebase-interactive.c @@ -5,6 +5,7 @@ #include "gettext.h" #include "sequencer.h" #include "rebase-interactive.h" +#include "repository.h" #include "strbuf.h" #include "commit-slab.h" #include "config.h" diff --git a/refs/files-backend.c b/refs/files-backend.c index 1128a9af292..212a0c14ea4 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -14,6 +14,7 @@ #include "../lockfile.h" #include "../object.h" #include "../object-file.h" +#include "../repository.h" #include "../dir.h" #include "../chdir-notify.h" #include "../setup.h" diff --git a/refs/packed-backend.c b/refs/packed-backend.c index 2333ed5a1f7..b3a46f9d4dd 100644 --- a/refs/packed-backend.c +++ b/refs/packed-backend.c @@ -9,6 +9,7 @@ #include "../iterator.h" #include "../lockfile.h" #include "../chdir-notify.h" +#include "../repository.h" #include "../wrapper.h" #include "../write-or-die.h" diff --git a/refs/ref-cache.c b/refs/ref-cache.c index dc1ca49c85f..84c3838c743 100644 --- a/refs/ref-cache.c +++ b/refs/ref-cache.c @@ -4,6 +4,7 @@ #include "refs-internal.h" #include "ref-cache.h" #include "../iterator.h" +#include "../repository.h" void add_entry_to_dir(struct ref_dir *dir, struct ref_entry *entry) { diff --git a/refs/ref-cache.h b/refs/ref-cache.h index cf4ad9070b9..31ebe24f6cf 100644 --- a/refs/ref-cache.h +++ b/refs/ref-cache.h @@ -5,6 +5,7 @@ struct ref_dir; struct ref_store; +struct repository; /* * If this ref_cache is filled lazily, this function is used to load diff --git a/refspec.c b/refspec.c index 7b5c305514d..68020ee84c6 100644 --- a/refspec.c +++ b/refspec.c @@ -5,6 +5,7 @@ #include "strvec.h" #include "refs.h" #include "refspec.h" +#include "repository.h" static struct refspec_item s_tag_refspec = { .force = 0, diff --git a/repository.h b/repository.h index 15a8afc5fb5..9e36868207f 100644 --- a/repository.h +++ b/repository.h @@ -1,6 +1,7 @@ #ifndef REPOSITORY_H #define REPOSITORY_H +#include "hash.h" #include "path.h" struct config_set; @@ -238,4 +239,99 @@ void prepare_repo_settings(struct repository *r); */ int upgrade_repository_format(int target_version); +#define the_hash_algo the_repository->hash_algo + +static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2) +{ + return hashcmp_algop(sha1, sha2, the_hash_algo); +} + +static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2) +{ + const struct git_hash_algo *algop; + if (!oid1->algo) + algop = the_hash_algo; + else + algop = &hash_algos[oid1->algo]; + return hashcmp_algop(oid1->hash, oid2->hash, algop); +} + +static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2) +{ + return hasheq_algop(sha1, sha2, the_hash_algo); +} + +static inline int oideq(const struct object_id *oid1, const struct object_id *oid2) +{ + const struct git_hash_algo *algop; + if (!oid1->algo) + algop = the_hash_algo; + else + algop = &hash_algos[oid1->algo]; + return hasheq_algop(oid1->hash, oid2->hash, algop); +} + +static inline int is_null_oid(const struct object_id *oid) +{ + return oideq(oid, null_oid()); +} + +static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src) +{ + memcpy(sha_dst, sha_src, the_hash_algo->rawsz); +} + +/* Like oidcpy() but zero-pads the unused bytes in dst's hash array. */ +static inline void oidcpy_with_padding(struct object_id *dst, + const struct object_id *src) +{ + size_t hashsz; + + if (!src->algo) + hashsz = the_hash_algo->rawsz; + else + hashsz = hash_algos[src->algo].rawsz; + + memcpy(dst->hash, src->hash, hashsz); + memset(dst->hash + hashsz, 0, GIT_MAX_RAWSZ - hashsz); + dst->algo = src->algo; +} + +static inline void hashclr(unsigned char *hash) +{ + memset(hash, 0, the_hash_algo->rawsz); +} + +static inline void oidclr(struct object_id *oid) +{ + memset(oid->hash, 0, GIT_MAX_RAWSZ); + oid->algo = hash_algo_by_ptr(the_hash_algo); +} + +static inline void oidread(struct object_id *oid, const unsigned char *hash) +{ + memcpy(oid->hash, hash, the_hash_algo->rawsz); + oid->algo = hash_algo_by_ptr(the_hash_algo); +} + +static inline int is_empty_blob_sha1(const unsigned char *sha1) +{ + return hasheq(sha1, the_hash_algo->empty_blob->hash); +} + +static inline int is_empty_blob_oid(const struct object_id *oid) +{ + return oideq(oid, the_hash_algo->empty_blob); +} + +static inline int is_empty_tree_sha1(const unsigned char *sha1) +{ + return hasheq(sha1, the_hash_algo->empty_tree->hash); +} + +static inline int is_empty_tree_oid(const struct object_id *oid) +{ + return oideq(oid, the_hash_algo->empty_tree); +} + #endif /* REPOSITORY_H */ diff --git a/resolve-undo.c b/resolve-undo.c index e81096e2d45..7dbd38a2cf9 100644 --- a/resolve-undo.c +++ b/resolve-undo.c @@ -1,6 +1,7 @@ #include "cache.h" #include "dir.h" #include "resolve-undo.h" +#include "repository.h" #include "string-list.h" /* The only error case is to run out of memory in string-list */ diff --git a/split-index.c b/split-index.c index 3fc4e91485a..bce6480084e 100644 --- a/split-index.c +++ b/split-index.c @@ -2,6 +2,7 @@ #include "alloc.h" #include "gettext.h" #include "mem-pool.h" +#include "repository.h" #include "split-index.h" #include "strbuf.h" #include "ewah/ewok.h" diff --git a/strbuf.c b/strbuf.c index 729378ec824..08eec8f1d8b 100644 --- a/strbuf.c +++ b/strbuf.c @@ -6,6 +6,7 @@ #include "hex.h" #include "object-name.h" #include "refs.h" +#include "repository.h" #include "string-list.h" #include "utf8.h" #include "date.h" diff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c index d2b30d644da..aabe31d724b 100644 --- a/t/helper/test-bloom.c +++ b/t/helper/test-bloom.c @@ -2,6 +2,7 @@ #include "bloom.h" #include "hex.h" #include "commit.h" +#include "repository.h" #include "setup.h" static struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS; diff --git a/t/helper/test-cache-tree.c b/t/helper/test-cache-tree.c index cdaf5046f5a..9507b356e22 100644 --- a/t/helper/test-cache-tree.c +++ b/t/helper/test-cache-tree.c @@ -6,6 +6,7 @@ #include "tree.h" #include "cache-tree.h" #include "parse-options.h" +#include "repository.h" #include "setup.h" static char const * const test_cache_tree_usage[] = { diff --git a/t/helper/test-dump-cache-tree.c b/t/helper/test-dump-cache-tree.c index 715aabfbae7..df30cc92d24 100644 --- a/t/helper/test-dump-cache-tree.c +++ b/t/helper/test-dump-cache-tree.c @@ -4,6 +4,7 @@ #include "hex.h" #include "tree.h" #include "cache-tree.h" +#include "repository.h" #include "setup.h" static void dump_one(struct cache_tree *it, const char *pfx, const char *x) diff --git a/t/helper/test-dump-fsmonitor.c b/t/helper/test-dump-fsmonitor.c index 7e9de296db3..6dc49583375 100644 --- a/t/helper/test-dump-fsmonitor.c +++ b/t/helper/test-dump-fsmonitor.c @@ -1,5 +1,6 @@ #include "test-tool.h" #include "cache.h" +#include "repository.h" #include "setup.h" int cmd__dump_fsmonitor(int ac, const char **av) diff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c index 415f55f31da..d1b99d21dcd 100644 --- a/t/helper/test-dump-untracked-cache.c +++ b/t/helper/test-dump-untracked-cache.c @@ -3,6 +3,7 @@ #include "cache.h" #include "dir.h" #include "hex.h" +#include "repository.h" #include "setup.h" static int compare_untracked(const void *a_, const void *b_) diff --git a/t/helper/test-example-decorate.c b/t/helper/test-example-decorate.c index 7c7fc8efc13..43707486dd4 100644 --- a/t/helper/test-example-decorate.c +++ b/t/helper/test-example-decorate.c @@ -2,6 +2,7 @@ #include "git-compat-util.h" #include "object.h" #include "decorate.h" +#include "repository.h" int cmd__example_decorate(int argc, const char **argv) { diff --git a/t/helper/test-fsmonitor-client.c b/t/helper/test-fsmonitor-client.c index a37236cd0a6..bb00e1e5d14 100644 --- a/t/helper/test-fsmonitor-client.c +++ b/t/helper/test-fsmonitor-client.c @@ -7,6 +7,7 @@ #include "cache.h" #include "parse-options.h" #include "fsmonitor-ipc.h" +#include "repository.h" #include "setup.h" #include "thread-utils.h" #include "trace2.h" diff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c index f23d983c118..b83a75d19f6 100644 --- a/t/helper/test-lazy-init-name-hash.c +++ b/t/helper/test-lazy-init-name-hash.c @@ -3,6 +3,7 @@ #include "cache.h" #include "environment.h" #include "parse-options.h" +#include "repository.h" #include "setup.h" #include "trace.h" diff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c index a498fece7a3..3c62e33ccdf 100644 --- a/t/helper/test-match-trees.c +++ b/t/helper/test-match-trees.c @@ -3,6 +3,7 @@ #include "hex.h" #include "match-trees.h" #include "object-name.h" +#include "repository.h" #include "setup.h" #include "tree.h" diff --git a/t/helper/test-oidmap.c b/t/helper/test-oidmap.c index de6ab77fdaa..bba4099f65f 100644 --- a/t/helper/test-oidmap.c +++ b/t/helper/test-oidmap.c @@ -2,6 +2,7 @@ #include "hex.h" #include "object-name.h" #include "oidmap.h" +#include "repository.h" #include "setup.h" #include "strbuf.h" diff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c index 6355c9e4b6d..2ef53d5f7a2 100644 --- a/t/helper/test-path-utils.c +++ b/t/helper/test-path-utils.c @@ -2,6 +2,7 @@ #include "cache.h" #include "abspath.h" #include "environment.h" +#include "path.h" #include "setup.h" #include "string-list.h" #include "trace.h" diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c index a4c24d0e421..c1ae2763954 100644 --- a/t/helper/test-read-cache.c +++ b/t/helper/test-read-cache.c @@ -2,6 +2,7 @@ #include "test-tool.h" #include "cache.h" #include "config.h" +#include "repository.h" #include "setup.h" #include "wrapper.h" diff --git a/t/helper/test-scrap-cache-tree.c b/t/helper/test-scrap-cache-tree.c index 15b7688774c..444a4c02c8d 100644 --- a/t/helper/test-scrap-cache-tree.c +++ b/t/helper/test-scrap-cache-tree.c @@ -2,6 +2,7 @@ #include "test-tool.h" #include "cache.h" #include "lockfile.h" +#include "repository.h" #include "setup.h" #include "tree.h" #include "cache-tree.h" diff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c index c7c7fdbea98..8b1969ea48d 100644 --- a/t/helper/test-submodule-config.c +++ b/t/helper/test-submodule-config.c @@ -1,6 +1,7 @@ #include "test-tool.h" #include "config.h" #include "object-name.h" +#include "repository.h" #include "setup.h" #include "submodule-config.h" #include "submodule.h" diff --git a/t/helper/test-submodule-nested-repo-config.c b/t/helper/test-submodule-nested-repo-config.c index d31f5e48ab5..ecd40ded995 100644 --- a/t/helper/test-submodule-nested-repo-config.c +++ b/t/helper/test-submodule-nested-repo-config.c @@ -1,4 +1,5 @@ #include "test-tool.h" +#include "repository.h" #include "setup.h" #include "submodule-config.h" diff --git a/t/helper/test-submodule.c b/t/helper/test-submodule.c index 0e34581b209..cad8b0ca681 100644 --- a/t/helper/test-submodule.c +++ b/t/helper/test-submodule.c @@ -2,6 +2,7 @@ #include "test-tool-utils.h" #include "parse-options.h" #include "remote.h" +#include "repository.h" #include "setup.h" #include "submodule-config.h" #include "submodule.h" diff --git a/t/helper/test-trace2.c b/t/helper/test-trace2.c index a476df6c6cb..ab084d6034e 100644 --- a/t/helper/test-trace2.c +++ b/t/helper/test-trace2.c @@ -3,6 +3,7 @@ #include "run-command.h" #include "exec-cmd.h" #include "config.h" +#include "repository.h" #include "trace2.h" typedef int(fn_unit_test)(int argc, const char **argv); diff --git a/t/helper/test-write-cache.c b/t/helper/test-write-cache.c index a93417ed3a9..eace08072d7 100644 --- a/t/helper/test-write-cache.c +++ b/t/helper/test-write-cache.c @@ -2,6 +2,7 @@ #include "test-tool.h" #include "cache.h" #include "lockfile.h" +#include "repository.h" #include "setup.h" int cmd__write_cache(int argc, const char **argv) diff --git a/trace2.c b/trace2.c index 21264df71b7..0efc4e7b958 100644 --- a/trace2.c +++ b/trace2.c @@ -2,6 +2,7 @@ #include "config.h" #include "json-writer.h" #include "quote.h" +#include "repository.h" #include "run-command.h" #include "sigchain.h" #include "thread-utils.h" diff --git a/trace2/tr2_tgt_event.c b/trace2/tr2_tgt_event.c index 9e7aab6d510..2af53e5d4de 100644 --- a/trace2/tr2_tgt_event.c +++ b/trace2/tr2_tgt_event.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "config.h" #include "json-writer.h" +#include "repository.h" #include "run-command.h" #include "version.h" #include "trace2/tr2_dst.h" diff --git a/trace2/tr2_tgt_normal.c b/trace2/tr2_tgt_normal.c index 8672c2c2d04..1ebfb464d54 100644 --- a/trace2/tr2_tgt_normal.c +++ b/trace2/tr2_tgt_normal.c @@ -1,5 +1,6 @@ #include "git-compat-util.h" #include "config.h" +#include "repository.h" #include "run-command.h" #include "quote.h" #include "version.h" diff --git a/trace2/tr2_tgt_perf.c b/trace2/tr2_tgt_perf.c index 3f2b2d53118..328e483a05e 100644 --- a/trace2/tr2_tgt_perf.c +++ b/trace2/tr2_tgt_perf.c @@ -1,5 +1,6 @@ #include "git-compat-util.h" #include "config.h" +#include "repository.h" #include "run-command.h" #include "quote.h" #include "version.h" diff --git a/tree-walk.h b/tree-walk.h index 25fe27e3529..1a3a1b8d4b1 100644 --- a/tree-walk.h +++ b/tree-walk.h @@ -4,6 +4,7 @@ #include "hash.h" struct index_state; +struct repository; #define MAX_TRAVERSE_TREES 8 diff --git a/tree.h b/tree.h index 6efff003e21..0499ad01aa7 100644 --- a/tree.h +++ b/tree.h @@ -3,6 +3,7 @@ #include "object.h" +struct pathspec; struct repository; struct strbuf; diff --git a/wrapper.c b/wrapper.c index e80f83498d8..5ab0460de5c 100644 --- a/wrapper.c +++ b/wrapper.c @@ -5,6 +5,7 @@ #include "abspath.h" #include "config.h" #include "gettext.h" +#include "repository.h" #include "strbuf.h" #include "trace2.h" #include "wrapper.h" From patchwork Sun Apr 16 03:03:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212690 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7B5DC77B70 for ; Sun, 16 Apr 2023 03:04:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230144AbjDPDEP (ORCPT ); Sat, 15 Apr 2023 23:04:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230137AbjDPDDw (ORCPT ); Sat, 15 Apr 2023 23:03:52 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B2533589 for ; Sat, 15 Apr 2023 20:03:39 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id o6-20020a05600c4fc600b003ef6e6754c5so9925020wmq.5 for ; Sat, 15 Apr 2023 20:03:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614218; x=1684206218; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=R/HFi0ckZ9f9c5JKPjheBJUsZjbIUK6v4/Q3vTbJKY0=; b=AHfdPSGIwAjFDJEyh33ENEfB4gokc/bVm0tYa9eMqQfl0moCv3M0cfNH+pElTH2zLF 1Tdh+ef+Z66p9pO/NLzEmgzrRydYRQugxguGV85rrIxiuOzS2qUP0hJAT63BfPu8vUaF rHrDbJZNTxS01JPm62lgaZOm+yr9JM2OgyWaOXfoVuy1oVDTuqsZrCmi/NnftpUhLwLx ZTaz70qoY1+vZkwEknpz239MoNhJTyM+osXfwCMyjbYwJ5BNYZgscuUtVQQFcfV2mQb/ jWeCw0vQOvvXrMFkDRsKsKOjq8FpISaKJ34Z3Rg6jPX/cmo0hc+SOfgiZo0yRoQoAb1E mh6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614218; x=1684206218; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R/HFi0ckZ9f9c5JKPjheBJUsZjbIUK6v4/Q3vTbJKY0=; b=Yi1pxMNXSfV0gPTgkJQ0MfASR+vJ5c8wqKKTjvhApG8lFb8cUbbiYMnpHDMiEnEnyI BPiuCgM/818xpuukL6utytLziR1/w3cnEr7M4NBbg9EF4Cj0g0njB2KTWjqpBQW2tFgL ngTh/Bprlx3oEehaYvh8pyBb48nUWViTNiKo8HDYYQj7mTgEIbiiOku8nYBGgsENflT9 FVudQq6PhTtqWOp6Pj7HCqYxp3b2XxkQz1FkMbQgayso5bFPyZAAczACA9bzuDV5Uexn AepXfJF/HFsOv9mlRUyxeRn0gpFa/KrNaMIsV4x09VnQLKtZzL0LeQYdannMNf2mQRAp Vybg== X-Gm-Message-State: AAQBX9eXK4CF2pjWBhu/qTGQqH9Oo68Sh2VWSvwA7ycJ7kdUbVVmGmTT NlptxW2kSuIJR8Eem8nMII3dDHLjXtQ= X-Google-Smtp-Source: AKy350a6VSx9dbeGKqF1YE0y0h7hfA9jTJ9cJ89IUzDfvjRAFU3FU+rpORT2fg/AkPgjHMKBp8Mv/g== X-Received: by 2002:a7b:c4d5:0:b0:3f1:71d2:da3a with SMTP id g21-20020a7bc4d5000000b003f171d2da3amr469855wmk.30.1681614217835; Sat, 15 Apr 2023 20:03:37 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id z8-20020a7bc7c8000000b003f07f0405b5sm8032264wmk.43.2023.04.15.20.03.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:37 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:17 +0000 Subject: [PATCH 15/23] cache,tree: move cmp_cache_name_compare from tree.[ch] to read-cache.c Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Since cmp_cache_name_compare() was comparing cache_entry structs, it was associated with the cache rather than with trees. Move the function. As a side effect, we can make cache_name_stage_compare() static as well. Signed-off-by: Elijah Newren --- cache.h | 2 +- read-cache.c | 13 ++++++++++++- tree.c | 10 ---------- tree.h | 1 - 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cache.h b/cache.h index 7a46f300d9b..502e4c0b11a 100644 --- a/cache.h +++ b/cache.h @@ -562,7 +562,7 @@ int base_name_compare(const char *name1, size_t len1, int mode1, int df_name_compare(const char *name1, size_t len1, int mode1, const char *name2, size_t len2, int mode2); int name_compare(const char *name1, size_t len1, const char *name2, size_t len2); -int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2); +int cmp_cache_name_compare(const void *a_, const void *b_); /* add */ /* diff --git a/read-cache.c b/read-cache.c index 206c003e558..8f00da4bf7a 100644 --- a/read-cache.c +++ b/read-cache.c @@ -567,7 +567,8 @@ int name_compare(const char *name1, size_t len1, const char *name2, size_t len2) return 0; } -int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2) +static int cache_name_stage_compare(const char *name1, int len1, int stage1, + const char *name2, int len2, int stage2) { int cmp; @@ -582,6 +583,16 @@ int cache_name_stage_compare(const char *name1, int len1, int stage1, const char return 0; } +int cmp_cache_name_compare(const void *a_, const void *b_) +{ + const struct cache_entry *ce1, *ce2; + + ce1 = *((const struct cache_entry **)a_); + ce2 = *((const struct cache_entry **)b_); + return cache_name_stage_compare(ce1->name, ce1->ce_namelen, ce_stage(ce1), + ce2->name, ce2->ce_namelen, ce_stage(ce2)); +} + static int index_name_stage_pos(struct index_state *istate, const char *name, int namelen, int stage, diff --git a/tree.c b/tree.c index e9d51ce2e00..896b7f4776b 100644 --- a/tree.c +++ b/tree.c @@ -94,16 +94,6 @@ int read_tree(struct repository *r, return ret; } -int cmp_cache_name_compare(const void *a_, const void *b_) -{ - const struct cache_entry *ce1, *ce2; - - ce1 = *((const struct cache_entry **)a_); - ce2 = *((const struct cache_entry **)b_); - return cache_name_stage_compare(ce1->name, ce1->ce_namelen, ce_stage(ce1), - ce2->name, ce2->ce_namelen, ce_stage(ce2)); -} - struct tree *lookup_tree(struct repository *r, const struct object_id *oid) { struct object *obj = lookup_object(r, oid); diff --git a/tree.h b/tree.h index 0499ad01aa7..8e3c6d441cc 100644 --- a/tree.h +++ b/tree.h @@ -29,7 +29,6 @@ void free_tree_buffer(struct tree *tree); /* Parses and returns the tree in the given ent, chasing tags and commits. */ struct tree *parse_tree_indirect(const struct object_id *oid); -int cmp_cache_name_compare(const void *a_, const void *b_); #define READ_TREE_RECURSIVE 1 typedef int (*read_tree_fn_t)(const struct object_id *, struct strbuf *, const char *, unsigned int, void *); From patchwork Sun Apr 16 03:03:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212691 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B399BC77B71 for ; Sun, 16 Apr 2023 03:04:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230219AbjDPDES (ORCPT ); Sat, 15 Apr 2023 23:04:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230142AbjDPDDw (ORCPT ); Sat, 15 Apr 2023 23:03:52 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21C3D35AA for ; Sat, 15 Apr 2023 20:03:40 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-2f771d17409so369475f8f.1 for ; Sat, 15 Apr 2023 20:03:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614218; x=1684206218; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=Ujdgogjwo5a/GoFw2T6ZNDHzRlcXZgJwPUxuSeev76s=; b=RHLv1/6QjC+fWqHo771dGwD8KFQrytVqRtQE3z5gOHwqXJYetSrkM63NgVNun7io9w kk85oCGA+HoNL1aONMnGb8ol1tQ6qpAKYTs1VU6O0CT/7vg0tM3F2uD6KZqXMlSOzobr SH8Hl74uNGHW1iK8ve3mMeXsRBvOqONFhVXd44ImZhefAoajPNBlWF05LZvTWV5/bMct /2vcxjEuxMzxeJlLydUegVSajm0mU9WVVUlYoVbFrgyoHVugoyMl1umX6TYwQnh1kcMB h4fcwesWxK5MIHZuDqAQQMkCgdMYfrBU6hd6TVcfq2hcSUgE8DuAVCs2LYglHr0bXIur b9Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614218; x=1684206218; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ujdgogjwo5a/GoFw2T6ZNDHzRlcXZgJwPUxuSeev76s=; b=bl5TalE/p2LcVV3+XUzd83/+/VOe3rZpeTCDbujytFmBv77LAqSdRBJUnRsHDGe3a5 SNiSqP5gOtZnSzzEwnC04Tnjmg3nu773Ni2yfIF3HB2ZFhvdvtZVEINLIo2yftwu7Tq0 r5gg6Q2AKtdyvRYuhee5tGlbXKGoWwxZ2ObIY6Y7YrDb5r0RMszPoKpocvK1i9qM4JmN E88/g3JMZSCz6I2m3qUzmOkpIbTM352MMaTX4PUunmO2nG4+SyGhVWXigfdpEjEKeSaV n7XFw1jGgXXtT9Gf4hrhsVx040XVk2qxc1ewk5JsqunuixILy1ZA7GtDeirMy0ihQxEH j+2A== X-Gm-Message-State: AAQBX9db3yDDgGFyxxhwYfuynN44D0TXcCCqstkzcSISuzAbJu5kKBH0 mT2sGt4kMFjAfynWlVzMp8mmo/5tlXs= X-Google-Smtp-Source: AKy350afwoqtiR7WWO+yzIqa3mVBJDI14lpdhcAzaG73udZ2oI8MuCa6xAvbfOPa/uiAR5DYSIWMXQ== X-Received: by 2002:a5d:4d44:0:b0:2f2:7adf:3c67 with SMTP id a4-20020a5d4d44000000b002f27adf3c67mr2090934wru.61.1681614218457; Sat, 15 Apr 2023 20:03:38 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id v14-20020a5d678e000000b002f2b8cb5d9csm7009699wru.28.2023.04.15.20.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:38 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:18 +0000 Subject: [PATCH 16/23] cache,tree: move basic name compare functions from read-cache to tree Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren None of base_name_compare(), df_name_compare(), or name_compare() depended upon a cache_entry or index_state in any way. By moving these functions to tree.h, half a dozen other files can stop depending upon cache.h (though that change will be made in a later commit). Signed-off-by: Elijah Newren --- cache.h | 5 ---- read-cache.c | 68 ---------------------------------------------------- tree.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tree.h | 9 +++++++ 4 files changed, 77 insertions(+), 73 deletions(-) diff --git a/cache.h b/cache.h index 502e4c0b11a..591c67b0595 100644 --- a/cache.h +++ b/cache.h @@ -557,11 +557,6 @@ extern int verify_ce_order; #define DATA_CHANGED 0x0020 #define TYPE_CHANGED 0x0040 -int base_name_compare(const char *name1, size_t len1, int mode1, - const char *name2, size_t len2, int mode2); -int df_name_compare(const char *name1, size_t len1, int mode1, - const char *name2, size_t len2, int mode2); -int name_compare(const char *name1, size_t len1, const char *name2, size_t len2); int cmp_cache_name_compare(const void *a_, const void *b_); /* add */ diff --git a/read-cache.c b/read-cache.c index 8f00da4bf7a..b3e2917ddc9 100644 --- a/read-cache.c +++ b/read-cache.c @@ -499,74 +499,6 @@ int ie_modified(struct index_state *istate, return 0; } -int base_name_compare(const char *name1, size_t len1, int mode1, - const char *name2, size_t len2, int mode2) -{ - unsigned char c1, c2; - size_t len = len1 < len2 ? len1 : len2; - int cmp; - - cmp = memcmp(name1, name2, len); - if (cmp) - return cmp; - c1 = name1[len]; - c2 = name2[len]; - if (!c1 && S_ISDIR(mode1)) - c1 = '/'; - if (!c2 && S_ISDIR(mode2)) - c2 = '/'; - return (c1 < c2) ? -1 : (c1 > c2) ? 1 : 0; -} - -/* - * df_name_compare() is identical to base_name_compare(), except it - * compares conflicting directory/file entries as equal. Note that - * while a directory name compares as equal to a regular file, they - * then individually compare _differently_ to a filename that has - * a dot after the basename (because '\0' < '.' < '/'). - * - * This is used by routines that want to traverse the git namespace - * but then handle conflicting entries together when possible. - */ -int df_name_compare(const char *name1, size_t len1, int mode1, - const char *name2, size_t len2, int mode2) -{ - unsigned char c1, c2; - size_t len = len1 < len2 ? len1 : len2; - int cmp; - - cmp = memcmp(name1, name2, len); - if (cmp) - return cmp; - /* Directories and files compare equal (same length, same name) */ - if (len1 == len2) - return 0; - c1 = name1[len]; - if (!c1 && S_ISDIR(mode1)) - c1 = '/'; - c2 = name2[len]; - if (!c2 && S_ISDIR(mode2)) - c2 = '/'; - if (c1 == '/' && !c2) - return 0; - if (c2 == '/' && !c1) - return 0; - return c1 - c2; -} - -int name_compare(const char *name1, size_t len1, const char *name2, size_t len2) -{ - size_t min_len = (len1 < len2) ? len1 : len2; - int cmp = memcmp(name1, name2, min_len); - if (cmp) - return cmp; - if (len1 < len2) - return -1; - if (len1 > len2) - return 1; - return 0; -} - static int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2) { diff --git a/tree.c b/tree.c index 896b7f4776b..f242a7ab691 100644 --- a/tree.c +++ b/tree.c @@ -94,6 +94,74 @@ int read_tree(struct repository *r, return ret; } +int base_name_compare(const char *name1, size_t len1, int mode1, + const char *name2, size_t len2, int mode2) +{ + unsigned char c1, c2; + size_t len = len1 < len2 ? len1 : len2; + int cmp; + + cmp = memcmp(name1, name2, len); + if (cmp) + return cmp; + c1 = name1[len]; + c2 = name2[len]; + if (!c1 && S_ISDIR(mode1)) + c1 = '/'; + if (!c2 && S_ISDIR(mode2)) + c2 = '/'; + return (c1 < c2) ? -1 : (c1 > c2) ? 1 : 0; +} + +/* + * df_name_compare() is identical to base_name_compare(), except it + * compares conflicting directory/file entries as equal. Note that + * while a directory name compares as equal to a regular file, they + * then individually compare _differently_ to a filename that has + * a dot after the basename (because '\0' < '.' < '/'). + * + * This is used by routines that want to traverse the git namespace + * but then handle conflicting entries together when possible. + */ +int df_name_compare(const char *name1, size_t len1, int mode1, + const char *name2, size_t len2, int mode2) +{ + unsigned char c1, c2; + size_t len = len1 < len2 ? len1 : len2; + int cmp; + + cmp = memcmp(name1, name2, len); + if (cmp) + return cmp; + /* Directories and files compare equal (same length, same name) */ + if (len1 == len2) + return 0; + c1 = name1[len]; + if (!c1 && S_ISDIR(mode1)) + c1 = '/'; + c2 = name2[len]; + if (!c2 && S_ISDIR(mode2)) + c2 = '/'; + if (c1 == '/' && !c2) + return 0; + if (c2 == '/' && !c1) + return 0; + return c1 - c2; +} + +int name_compare(const char *name1, size_t len1, const char *name2, size_t len2) +{ + size_t min_len = (len1 < len2) ? len1 : len2; + int cmp = memcmp(name1, name2, min_len); + if (cmp) + return cmp; + if (len1 < len2) + return -1; + if (len1 > len2) + return 1; + return 0; +} + struct tree *lookup_tree(struct repository *r, const struct object_id *oid) { struct object *obj = lookup_object(r, oid); diff --git a/tree.h b/tree.h index 8e3c6d441cc..1b5ecbda6b3 100644 --- a/tree.h +++ b/tree.h @@ -29,6 +29,15 @@ void free_tree_buffer(struct tree *tree); /* Parses and returns the tree in the given ent, chasing tags and commits. */ struct tree *parse_tree_indirect(const struct object_id *oid); +/* + * Functions for comparing pathnames + */ +int base_name_compare(const char *name1, size_t len1, int mode1, + const char *name2, size_t len2, int mode2); +int df_name_compare(const char *name1, size_t len1, int mode1, + const char *name2, size_t len2, int mode2); +int name_compare(const char *name1, size_t len1, + const char *name2, size_t len2); #define READ_TREE_RECURSIVE 1 typedef int (*read_tree_fn_t)(const struct object_id *, struct strbuf *, const char *, unsigned int, void *); From patchwork Sun Apr 16 03:03:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212695 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A125C77B70 for ; Sun, 16 Apr 2023 03:04:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230250AbjDPDEc (ORCPT ); Sat, 15 Apr 2023 23:04:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230146AbjDPDEF (ORCPT ); Sat, 15 Apr 2023 23:04:05 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C1583AAC for ; Sat, 15 Apr 2023 20:03:41 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-2f833bda191so358296f8f.1 for ; Sat, 15 Apr 2023 20:03:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614219; x=1684206219; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=pK12Lt1pX0eW4dJZARMpQPzqEs1xZsYrJB6Jb04eeVk=; b=DD/4stqxB4PjBKn8VUipeq7jvlpxFepW0Vwzz3I550BV7vJmfb1XEWEbqvh0kKghpG ZNdMaZ9KJx3zdzYZxNGKtzY8pjIWRNEQQubAzV2W2B5TkS38WL/mfh795ADhBKshmUW8 PhfE2vO13cyfVlDv8LeMiKIEgCVOvyjvX7U3PPI8MUO82gN7sGyz0dtunp0cP5RBTrrz jx3zX9IwfkiQxd8cyLbeHjRK0gaGnc525J1iGZx9TKZ7FMiOgya8frhHtRJjpyP41e2s V94Kby2gXMyF7tq8aczQquzwQciXa8r1TPGPFZYH0U4vbpGYdliRe0jUteS0Jez67koW +Hqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614219; x=1684206219; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pK12Lt1pX0eW4dJZARMpQPzqEs1xZsYrJB6Jb04eeVk=; b=IQC6p2bEjOX7fmWc/GDLBaHW7Iu5lG1Ax90Vec3XkaFb5AVV+tg+iMpIB6B+WwAC9D 5hovRfcyAHFfShxJgp+ZVAy34opS4xyyf5vF/L7Dstj8mdhHSyIwUnfPTjjSk7AqMEty bMdYUcNy/zAPQyEWRrPOHijoyXeX1xChduIGh69m9wd+rF+8zDT7wHcmmV8bXGXD2K19 dAQuZFFEEG0o9hrFhRrKolUsuGL2EmVEpgvuOxNl6CUmDckBEN1t+41Dw69n4apjSWN1 UqL7b8c9gDfeHWnBxkxATzzZC37vA9m/Vyt8IIzJL/huh9vQg49e8oHQez420CE3XNLY 4gCQ== X-Gm-Message-State: AAQBX9fILPg8sY4JX48RkS+zTtwnxFTHnIcboyaupYRXpduhrA74JsCq 4PbWj9xBtQEPkN4TyyXejL36MbX9Mlg= X-Google-Smtp-Source: AKy350YzJpTPU9qi78SkGxSzeC5RCEaII/IgoULJkk+a2JAOKMHDFtjTmJ165bMoYAYDuj+7uteI6g== X-Received: by 2002:a5d:66ca:0:b0:2f5:296a:61b4 with SMTP id k10-20020a5d66ca000000b002f5296a61b4mr2428232wrw.60.1681614219049; Sat, 15 Apr 2023 20:03:39 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id u8-20020a5d6ac8000000b002eaac3a9beesm7031552wrw.8.2023.04.15.20.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:38 -0700 (PDT) Message-Id: <1edd8fd72a7e0580caaddf9a5e23502bdbc6ab8d.1681614206.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:19 +0000 Subject: [PATCH 17/23] treewide: remove cache.h inclusion due to previous changes Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- archive-zip.c | 2 +- bundle-uri.c | 2 +- color.c | 2 +- combine-diff.c | 2 +- common-main.c | 2 +- config.c | 2 +- copy.c | 2 +- credential.c | 2 +- daemon.c | 2 +- date.c | 2 +- diagnose.c | 2 +- environment.c | 2 +- ll-merge.c | 2 +- match-trees.c | 2 +- midx.c | 2 +- object-file.c | 2 +- packfile.c | 2 +- pkt-line.c | 2 +- range-diff.c | 2 +- ref-filter.c | 2 +- t/helper/test-match-trees.c | 1 - t/helper/test-mergesort.c | 1 - t/helper/test-oid-array.c | 1 - t/helper/test-oidtree.c | 1 - t/helper/test-parse-options.c | 1 - t/helper/test-read-midx.c | 1 - t/helper/test-string-list.c | 1 - tree-diff.c | 2 +- tree-walk.c | 2 +- tree.c | 2 +- wrapper.c | 3 ++- 31 files changed, 25 insertions(+), 31 deletions(-) diff --git a/archive-zip.c b/archive-zip.c index ef538a90df4..d0d065a312e 100644 --- a/archive-zip.c +++ b/archive-zip.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2006 Rene Scharfe */ -#include "cache.h" +#include "git-compat-util.h" #include "config.h" #include "archive.h" #include "gettext.h" diff --git a/bundle-uri.c b/bundle-uri.c index 6d44662ee1f..ec1552bbca2 100644 --- a/bundle-uri.c +++ b/bundle-uri.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "bundle-uri.h" #include "bundle.h" #include "copy.h" diff --git a/color.c b/color.c index f8a25ca807b..83abb11eda0 100644 --- a/color.c +++ b/color.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "config.h" #include "color.h" #include "editor.h" diff --git a/combine-diff.c b/combine-diff.c index f7e9fb57473..f8d61965776 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "object-store.h" #include "commit.h" #include "convert.h" diff --git a/common-main.c b/common-main.c index 8ab50fa37a4..033778b3c56 100644 --- a/common-main.c +++ b/common-main.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "exec-cmd.h" #include "gettext.h" #include "attr.h" diff --git a/config.c b/config.c index 97063a0743e..2a9ed27efe5 100644 --- a/config.c +++ b/config.c @@ -5,7 +5,7 @@ * Copyright (C) Johannes Schindelin, 2005 * */ -#include "cache.h" +#include "git-compat-util.h" #include "abspath.h" #include "advice.h" #include "alloc.h" diff --git a/copy.c b/copy.c index 923d8a6dc61..882c79cffb0 100644 --- a/copy.c +++ b/copy.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "copy.h" #include "path.h" #include "wrapper.h" diff --git a/credential.c b/credential.c index 42194efc9e0..a600d0c1ac1 100644 --- a/credential.c +++ b/credential.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "abspath.h" #include "config.h" #include "credential.h" diff --git a/daemon.c b/daemon.c index f89f99d7ef4..7139cc201d7 100644 --- a/daemon.c +++ b/daemon.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "abspath.h" #include "alloc.h" #include "config.h" diff --git a/date.c b/date.c index bc030da012f..a6ca6b318bd 100644 --- a/date.c +++ b/date.c @@ -4,7 +4,7 @@ * Copyright (C) Linus Torvalds, 2005 */ -#include "cache.h" +#include "git-compat-util.h" #include "date.h" #include "gettext.h" #include "pager.h" diff --git a/diagnose.c b/diagnose.c index f9a2496c7ff..58f49f76c7a 100644 --- a/diagnose.c +++ b/diagnose.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "diagnose.h" #include "compat/disk.h" #include "archive.h" diff --git a/environment.c b/environment.c index 541f0b19acf..28d18eaca8e 100644 --- a/environment.c +++ b/environment.c @@ -7,7 +7,7 @@ * even if you might want to know where the git directory etc * are. */ -#include "cache.h" +#include "git-compat-util.h" #include "abspath.h" #include "branch.h" #include "convert.h" diff --git a/ll-merge.c b/ll-merge.c index 85517e668e3..1993530688e 100644 --- a/ll-merge.c +++ b/ll-merge.c @@ -4,7 +4,7 @@ * Copyright (c) 2007 Junio C Hamano */ -#include "cache.h" +#include "git-compat-util.h" #include "config.h" #include "convert.h" #include "attr.h" diff --git a/match-trees.c b/match-trees.c index 9b78d99507b..6bc8eb76477 100644 --- a/match-trees.c +++ b/match-trees.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "hex.h" #include "match-trees.h" #include "tree.h" diff --git a/midx.c b/midx.c index 2d0da573281..c7679c3c4f5 100644 --- a/midx.c +++ b/midx.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "abspath.h" #include "alloc.h" #include "config.h" diff --git a/object-file.c b/object-file.c index 8163ddbaddd..8e0df7360ae 100644 --- a/object-file.c +++ b/object-file.c @@ -6,7 +6,7 @@ * This handles basic git object files - packing, unpacking, * creation etc. */ -#include "cache.h" +#include "git-compat-util.h" #include "abspath.h" #include "alloc.h" #include "config.h" diff --git a/packfile.c b/packfile.c index 9ae2278c22e..1ee9f65242c 100644 --- a/packfile.c +++ b/packfile.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "alloc.h" #include "environment.h" #include "gettext.h" diff --git a/pkt-line.c b/pkt-line.c index 8b5fa788517..62b4208b66e 100644 --- a/pkt-line.c +++ b/pkt-line.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "copy.h" #include "pkt-line.h" #include "gettext.h" diff --git a/range-diff.c b/range-diff.c index a1e0cffb9f6..6a704e6f471 100644 --- a/range-diff.c +++ b/range-diff.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "environment.h" #include "gettext.h" #include "range-diff.h" diff --git a/ref-filter.c b/ref-filter.c index 5387f79be6d..594e66ad361 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "alloc.h" #include "environment.h" #include "gettext.h" diff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c index 3c62e33ccdf..a0afc1b4bc8 100644 --- a/t/helper/test-match-trees.c +++ b/t/helper/test-match-trees.c @@ -1,5 +1,4 @@ #include "test-tool.h" -#include "cache.h" #include "hex.h" #include "match-trees.h" #include "object-name.h" diff --git a/t/helper/test-mergesort.c b/t/helper/test-mergesort.c index 3aabae6c1c4..42ccc870516 100644 --- a/t/helper/test-mergesort.c +++ b/t/helper/test-mergesort.c @@ -1,5 +1,4 @@ #include "test-tool.h" -#include "cache.h" #include "mem-pool.h" #include "mergesort.h" #include "strbuf.h" diff --git a/t/helper/test-oid-array.c b/t/helper/test-oid-array.c index ea3bf278984..241e5da3157 100644 --- a/t/helper/test-oid-array.c +++ b/t/helper/test-oid-array.c @@ -1,5 +1,4 @@ #include "test-tool.h" -#include "cache.h" #include "hex.h" #include "oid-array.h" #include "setup.h" diff --git a/t/helper/test-oidtree.c b/t/helper/test-oidtree.c index 796c9811e0f..dc509fb8065 100644 --- a/t/helper/test-oidtree.c +++ b/t/helper/test-oidtree.c @@ -1,5 +1,4 @@ #include "test-tool.h" -#include "cache.h" #include "hex.h" #include "oidtree.h" #include "setup.h" diff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c index 20a81a1eb21..3003987ec17 100644 --- a/t/helper/test-parse-options.c +++ b/t/helper/test-parse-options.c @@ -1,5 +1,4 @@ #include "test-tool.h" -#include "cache.h" #include "parse-options.h" #include "strbuf.h" #include "string-list.h" diff --git a/t/helper/test-read-midx.c b/t/helper/test-read-midx.c index b32abff7f11..211addaa005 100644 --- a/t/helper/test-read-midx.c +++ b/t/helper/test-read-midx.c @@ -1,5 +1,4 @@ #include "test-tool.h" -#include "cache.h" #include "hex.h" #include "midx.h" #include "repository.h" diff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c index 959f27c74c6..042c6ff0059 100644 --- a/t/helper/test-string-list.c +++ b/t/helper/test-string-list.c @@ -1,5 +1,4 @@ #include "test-tool.h" -#include "cache.h" #include "strbuf.h" #include "string-list.h" diff --git a/tree-diff.c b/tree-diff.c index a76e6dae619..9ea2dd7a6c3 100644 --- a/tree-diff.c +++ b/tree-diff.c @@ -1,7 +1,7 @@ /* * Helper functions for tree diff generation */ -#include "cache.h" +#include "git-compat-util.h" #include "diff.h" #include "diffcore.h" #include "tree.h" diff --git a/tree-walk.c b/tree-walk.c index 2993c48c2f3..d3c48e06df0 100644 --- a/tree-walk.c +++ b/tree-walk.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "tree-walk.h" #include "alloc.h" #include "dir.h" diff --git a/tree.c b/tree.c index f242a7ab691..0dd2029a8a2 100644 --- a/tree.c +++ b/tree.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "cache-tree.h" #include "hex.h" #include "tree.h" diff --git a/wrapper.c b/wrapper.c index 5ab0460de5c..67f5f5dbe19 100644 --- a/wrapper.c +++ b/wrapper.c @@ -1,10 +1,11 @@ /* * Various trivial helper wrappers around standard functions */ -#include "cache.h" +#include "git-compat-util.h" #include "abspath.h" #include "config.h" #include "gettext.h" +#include "object.h" #include "repository.h" #include "strbuf.h" #include "trace2.h" From patchwork Sun Apr 16 03:03:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212692 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52AF0C77B70 for ; Sun, 16 Apr 2023 03:04:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230151AbjDPDEU (ORCPT ); Sat, 15 Apr 2023 23:04:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230112AbjDPDEE (ORCPT ); Sat, 15 Apr 2023 23:04:04 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 244DE35BB for ; Sat, 15 Apr 2023 20:03:40 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id bd13-20020a05600c1f0d00b003f14c42cc99so2431629wmb.2 for ; Sat, 15 Apr 2023 20:03:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614219; x=1684206219; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=rkh3h+0otRtSW4DljvrgG6353s+aSsn0CnyhephkYW4=; b=AHxJG13w0uo5Coe4gugI3PpK7I/Wc/9aqpZVKFiuJG9cX8rmfa0NoNk127LZCtjZ52 AbqlNyma4C7mlSzmZzYoayjRp3IosbY6wCHvjzMP3kh6YmZExFRdXl/Rt7i1KrLMhQn+ 8sTIguZf5G/JQDHDocNTu66EyBAwXfQ7DXPyoagz11/RDkczoLq2Gyz/0VRBIDP32zJN YHIqbld9ZpCqch6l64sZH4BTEkhGiZMIqomPGycVK+cqbVnhEAA5l0I7OtrI5lFQOUas aUpN6LI/C4f9oBMHkX/svPcaWP1N1tRKdKjGtM3XYGpExGqvSVLGI4TtCtk2wUdwY5tv mIwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614219; x=1684206219; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rkh3h+0otRtSW4DljvrgG6353s+aSsn0CnyhephkYW4=; b=We+DijjjJe3YQVwTRj4meCxlq54kg4rX37H7ywkYrW6DNhRf+B51yLzihepNuVWtbG smA4lly/ascIfoZ8212fo2DT+0jreudxBEDy4h+DaylwUfqQN+9AzI/irb5BjEih8mmk 9GsKcgksgt1Hyf6Bb8WIxLhHuI13zQ4QGk6mVB3SVYr4WkAer8BiJ7DVI8yYbPXfGdsJ rhB0Ny1w9sn9NTKKIo2qJhRARW3QKOi721ZdBvB6qk8NLZM8amhBVKxqmCWszkhHzqH0 gi5QVXq15O+9T3/aV/+wFhOKOdj+mrH2SKdrg7x0DCUg2NJk6/MtXvIdl64EvQY0js8Y b1Vw== X-Gm-Message-State: AAQBX9cnC3RfXZEbOoEgfXeP2TqTfQEwxAmNP+7rQB4+8Uy76yFXZ8yh ohamBNgdl63ikLHEakvlMBv1OgF43Ag= X-Google-Smtp-Source: AKy350aFqdzX+ZrJRMxwFmmdfJNTcVpDX1r2DOv0Kh+EQ3IdAfObJHv33sLAuYsr3Wlbl3DAA9i2dA== X-Received: by 2002:a05:600c:254:b0:3ed:4416:d2ff with SMTP id 20-20020a05600c025400b003ed4416d2ffmr7257887wmj.28.1681614219488; Sat, 15 Apr 2023 20:03:39 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id t15-20020a05600c198f00b003f0a007b802sm10777336wmq.12.2023.04.15.20.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:39 -0700 (PDT) Message-Id: <34c9034e8edb997cfd38a69dd71bfa41070f4397.1681614206.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:20 +0000 Subject: [PATCH 18/23] cache.h: remove unnecessary headers Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- cache.h | 2 -- compat/fsmonitor/fsm-ipc-darwin.c | 1 + compat/fsmonitor/fsm-listen-darwin.c | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cache.h b/cache.h index 591c67b0595..bdedb87e83b 100644 --- a/cache.h +++ b/cache.h @@ -4,8 +4,6 @@ #include "git-compat-util.h" #include "strbuf.h" #include "hashmap.h" -#include "gettext.h" -#include "string-list.h" #include "pathspec.h" #include "object.h" #include "statinfo.h" diff --git a/compat/fsmonitor/fsm-ipc-darwin.c b/compat/fsmonitor/fsm-ipc-darwin.c index e62f093cc19..bc68dca0cae 100644 --- a/compat/fsmonitor/fsm-ipc-darwin.c +++ b/compat/fsmonitor/fsm-ipc-darwin.c @@ -1,5 +1,6 @@ #include "cache.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "repository.h" #include "strbuf.h" diff --git a/compat/fsmonitor/fsm-listen-darwin.c b/compat/fsmonitor/fsm-listen-darwin.c index 5eb6402ab82..18c0e3913dc 100644 --- a/compat/fsmonitor/fsm-listen-darwin.c +++ b/compat/fsmonitor/fsm-listen-darwin.c @@ -29,6 +29,7 @@ #include "fsmonitor--daemon.h" #include "fsmonitor-path-utils.h" #include "gettext.h" +#include "string-list.h" struct fsm_listen_data { From patchwork Sun Apr 16 03:03:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212694 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E274EC77B71 for ; Sun, 16 Apr 2023 03:04:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230167AbjDPDE3 (ORCPT ); Sat, 15 Apr 2023 23:04:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230145AbjDPDEE (ORCPT ); Sat, 15 Apr 2023 23:04:04 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9DD235A9 for ; Sat, 15 Apr 2023 20:03:40 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id he11-20020a05600c540b00b003ef6d684102so10093076wmb.3 for ; Sat, 15 Apr 2023 20:03:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614220; x=1684206220; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=caqEkUUJKCXtt2lsnjPJjPm3xKgdR7jcbub+VtGBaIg=; b=Ns0gV6R6fQMjkWulnWiuwh62Vuq8xKdFRuf9u5jk1EIpEAtl0I/PunzCw7CWmKTwTN reKEXc50K57mCXARnX/NJ+CqU7wJm3quoZ7wVphXHMiWtFC9JJtEg1RxZ6ASOyI9f/uF AE+qcdXgTFZljdmfCqq6wHccCb7igdL7VJUROqJEqMhLRRquedShE/myojfT6LInn94z WNfQN48uVF1O2WiyrcAZwI21dusyZJAWdMgMDppMiSWQzTQ2r7kceBSD9sXjH5RsPZgv 1JAwZwV/7bD/+weSTv4DnxVopKGPAbKmxVYuwx8M801ITXbmw21KSoica0eG7JAm4JeZ KCuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614220; x=1684206220; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=caqEkUUJKCXtt2lsnjPJjPm3xKgdR7jcbub+VtGBaIg=; b=ecHigAZiXSWyMD5UYKh4PFpjbxqYwKdujayKlXJqefIgKS+QRXCKrbWOOcIpBWPT5S gCDGmZUloW5pDM4eJIS4/0pwfyJpIVBpHur2mYLzCYUUCdpcTj/QNH0fJMR8gIqfZ1/u xREv4QG99hWzXF1hULWfP5ZA5lflfaccID1XmtqCi0TCBeNuvgzn72WsM2S0hgGLzbeX YR9TY9n/Sk+OfCdJjiKxDX5WnELawgl7ZAZfdL+U6cwlQmY/z7SXofhU2nrChyWMmaIW kw4BJuK1OPhvjqtTvmaomYjtjof0ZQW6SZgjLKiydn2JReKqx+7y3TlDKDC6q0NGAcT3 14TA== X-Gm-Message-State: AAQBX9c+gB8s00CHGPi/bWgC/cPPUn4RnSqAS+8IJKBKxXhzb2eUAwxv 4Qw095wUab8voExuSGS5zu0ti/J+S4U= X-Google-Smtp-Source: AKy350aE0cTUcD92mGkz+e/Qn9DsmQtVc3TvB1Ilpqm/vy74UBNICqlGia56Wn3wzWWGIVWJpRgYrw== X-Received: by 2002:a05:600c:21c4:b0:3f1:6ef6:c9d6 with SMTP id x4-20020a05600c21c400b003f16ef6c9d6mr1815154wmj.32.1681614220067; Sat, 15 Apr 2023 20:03:40 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id y1-20020a1c4b01000000b003ef5f77901dsm8061741wma.45.2023.04.15.20.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:39 -0700 (PDT) Message-Id: <8e747e889fbe680e83cd9880cc4b0ff1430eb93b.1681614206.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:21 +0000 Subject: [PATCH 19/23] fsmonitor: reduce includes of cache.h Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- compat/fsmonitor/fsm-health-darwin.c | 2 +- compat/fsmonitor/fsm-ipc-darwin.c | 2 +- compat/fsmonitor/fsm-listen-darwin.c | 2 +- fsmonitor--daemon.h | 1 - 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/compat/fsmonitor/fsm-health-darwin.c b/compat/fsmonitor/fsm-health-darwin.c index b9f709e8548..4c291f8a066 100644 --- a/compat/fsmonitor/fsm-health-darwin.c +++ b/compat/fsmonitor/fsm-health-darwin.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "config.h" #include "fsmonitor.h" #include "fsm-health.h" diff --git a/compat/fsmonitor/fsm-ipc-darwin.c b/compat/fsmonitor/fsm-ipc-darwin.c index bc68dca0cae..793073aaa72 100644 --- a/compat/fsmonitor/fsm-ipc-darwin.c +++ b/compat/fsmonitor/fsm-ipc-darwin.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "config.h" #include "gettext.h" #include "hex.h" diff --git a/compat/fsmonitor/fsm-listen-darwin.c b/compat/fsmonitor/fsm-listen-darwin.c index 18c0e3913dc..23e24b4b374 100644 --- a/compat/fsmonitor/fsm-listen-darwin.c +++ b/compat/fsmonitor/fsm-listen-darwin.c @@ -23,7 +23,7 @@ #endif #endif -#include "cache.h" +#include "git-compat-util.h" #include "fsmonitor.h" #include "fsm-listen.h" #include "fsmonitor--daemon.h" diff --git a/fsmonitor--daemon.h b/fsmonitor--daemon.h index e24838f9a86..70d776c54f6 100644 --- a/fsmonitor--daemon.h +++ b/fsmonitor--daemon.h @@ -3,7 +3,6 @@ #ifdef HAVE_FSMONITOR_DAEMON_BACKEND -#include "cache.h" #include "dir.h" #include "run-command.h" #include "simple-ipc.h" From patchwork Sun Apr 16 03:03:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212698 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FACAC77B71 for ; Sun, 16 Apr 2023 03:04:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230273AbjDPDEo (ORCPT ); Sat, 15 Apr 2023 23:04:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230178AbjDPDEN (ORCPT ); Sat, 15 Apr 2023 23:04:13 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A82B3AAE for ; Sat, 15 Apr 2023 20:03:42 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id o9-20020a05600c510900b003f17012276fso509182wms.4 for ; Sat, 15 Apr 2023 20:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614220; x=1684206220; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=2Para9K873EeJhpyq7CI7rxs9jB2w3YqWXnEBSZEC70=; b=fBpStCjmOORu4w5LzFtRfZLv6BsehACCzRckai4dceECPNlhHAumoqnZV6JBygDVGK V1wKhpj5uQ59xGPXkxdooH7m4ikbJa5lh684wkvlyf7To+jKIdkqvhFX8Rzuq0A/aUpH vHwRFD8WvwmHXWdRs1wQYIxRFUgugvroVBMilZAOaze3DtcqmThVej5QF5pyav+gxywI 9LTr9tXTcp8UwlJAzoyvrnjxYfnr8hIuqmK8FXqK8x1jCcj9dLMopIaPsvR2HUv+5FDs zmXYhwjQYnTvQynnLZ3KyuIBkHoTYAm9ro4Kasm9OcROSaIBhhy92CyWcgrsiXCAVLgT CBiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614220; x=1684206220; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2Para9K873EeJhpyq7CI7rxs9jB2w3YqWXnEBSZEC70=; b=i5pKwYAfFPCBe2PO0wkYcgvpsMZhMtdsLYKaJRMNooCemV0Bi1+wk/KtURP5wka90C 6LW/8qqVVjdqLdvfBgGSSLhsWGvUYFH4bVeT5o+QbX2Z4E2c8BjoLRkgp/lBbCOUtdIL 2WkiSH0JmfMnScRM8h2099/NnqMtBO/CLtwckcjIIPUyIqHZaFoS0LuDuxZjQ/gjWXXO SzLd4Gdpg7N0vFiiiCa9DSwqCjHHNC4ax6/eNpdgxp+EYM6yBsgznxPq9cCBHE1QUUUm x0/m9ywF8Kry2XRYVOlL9LGJpPM+4k0uG90v087AIukcAyr0IM5xhFz7ClYi/pf5TynS VWWw== X-Gm-Message-State: AAQBX9cvCDDyW1IwyNtCLqP8fEniBLCAcGMqndqM8HqPNW+TkZmeA7Rt l3bZECHjCHqjh0jF1YRTD6gowlCsaQM= X-Google-Smtp-Source: AKy350bDM8pTraGZpErCvo5iRlJ4GRbxDA7YDQl2Mh8E19H7GYiqc3h80LBQNGrkgc5UaQQwiapXPA== X-Received: by 2002:a05:600c:2152:b0:3f1:6581:1acc with SMTP id v18-20020a05600c215200b003f165811accmr3073983wml.38.1681614220661; Sat, 15 Apr 2023 20:03:40 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id g15-20020a05600c4ecf00b003edc4788fa0sm11961956wmq.2.2023.04.15.20.03.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:40 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:22 +0000 Subject: [PATCH 20/23] commit.h: reduce unnecessary includes Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- add-interactive.c | 1 + archive.c | 2 ++ bloom.c | 1 + builtin/diff-tree.c | 1 + builtin/diff.c | 1 + builtin/gc.c | 1 + builtin/log.c | 1 + builtin/merge-tree.c | 1 + combine-diff.c | 1 + commit-graph.c | 1 + commit.c | 1 + commit.h | 11 ++++------- dir.c | 1 + fetch-pack.c | 1 + fsck.c | 1 + gpg-interface.c | 1 + grep.c | 1 + http-push.c | 1 + log-tree.c | 1 + merge-ort-wrappers.c | 1 + merge.c | 1 + notes-cache.c | 1 + notes-utils.c | 1 + object-name.c | 1 + pack-bitmap-write.c | 1 + parse-options-cb.c | 1 + parse-options.c | 1 + read-cache.c | 1 + ref-filter.c | 1 + reflog.c | 1 + refs/debug.c | 1 + refspec.c | 1 + revision.h | 1 + send-pack.c | 1 + wt-status.c | 1 + 35 files changed, 39 insertions(+), 7 deletions(-) diff --git a/add-interactive.c b/add-interactive.c index 757a9929d41..de877ca0525 100644 --- a/add-interactive.c +++ b/add-interactive.c @@ -12,6 +12,7 @@ #include "dir.h" #include "run-command.h" #include "prompt.h" +#include "tree.h" static void init_color(struct repository *r, struct add_i_state *s, const char *section_and_slot, char *dst, diff --git a/archive.c b/archive.c index ab8966d73a5..6226e16b25e 100644 --- a/archive.c +++ b/archive.c @@ -6,10 +6,12 @@ #include "environment.h" #include "gettext.h" #include "hex.h" +#include "pretty.h" #include "setup.h" #include "refs.h" #include "object-store.h" #include "commit.h" +#include "tree.h" #include "tree-walk.h" #include "attr.h" #include "archive.h" diff --git a/bloom.c b/bloom.c index d0730525da5..aef6b5fea2d 100644 --- a/bloom.c +++ b/bloom.c @@ -6,6 +6,7 @@ #include "hashmap.h" #include "commit-graph.h" #include "commit.h" +#include "commit-slab.h" define_commit_slab(bloom_filter_slab, struct bloom_filter); diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c index 385c2d0230c..0b02c62b85e 100644 --- a/builtin/diff-tree.c +++ b/builtin/diff-tree.c @@ -9,6 +9,7 @@ #include "builtin.h" #include "submodule.h" #include "repository.h" +#include "tree.h" static struct rev_info log_tree_opt; diff --git a/builtin/diff.c b/builtin/diff.c index 8f386535d61..457dee14457 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -22,6 +22,7 @@ #include "setup.h" #include "submodule.h" #include "oid-array.h" +#include "tree.h" #define DIFF_NO_INDEX_EXPLICIT 1 #define DIFF_NO_INDEX_IMPLICIT 2 diff --git a/builtin/gc.c b/builtin/gc.c index b95154fba16..d11712b1444 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -12,6 +12,7 @@ #include "builtin.h" #include "abspath.h" +#include "date.h" #include "environment.h" #include "hex.h" #include "repository.h" diff --git a/builtin/log.c b/builtin/log.c index 95de51921f8..137b84b31ef 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -44,6 +44,7 @@ #include "commit-reach.h" #include "range-diff.h" #include "tmp-objdir.h" +#include "tree.h" #include "write-or-die.h" #define MAIL_DEFAULT_WRAP 72 diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index 6b9f006ec19..aa8040c2a6a 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -16,6 +16,7 @@ #include "exec-cmd.h" #include "merge-blobs.h" #include "quote.h" +#include "tree.h" static int line_termination = '\n'; diff --git a/combine-diff.c b/combine-diff.c index f8d61965776..1e3cd7fb170 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -13,6 +13,7 @@ #include "xdiff/xmacros.h" #include "log-tree.h" #include "refs.h" +#include "tree.h" #include "userdiff.h" #include "oid-array.h" #include "revision.h" diff --git a/commit-graph.c b/commit-graph.c index 0c4f2266445..6f612f368ba 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -23,6 +23,7 @@ #include "shallow.h" #include "json-writer.h" #include "trace2.h" +#include "tree.h" #include "chunk-format.h" #include "wrapper.h" diff --git a/commit.c b/commit.c index 878b4473e4c..10676165a1d 100644 --- a/commit.c +++ b/commit.c @@ -26,6 +26,7 @@ #include "run-command.h" #include "setup.h" #include "shallow.h" +#include "tree.h" #include "hook.h" static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **); diff --git a/commit.h b/commit.h index 69b2f376e9d..28928833c54 100644 --- a/commit.h +++ b/commit.h @@ -2,13 +2,10 @@ #define COMMIT_H #include "object.h" -#include "tree.h" -#include "strbuf.h" -#include "decorate.h" -#include "gpg-interface.h" -#include "string-list.h" -#include "pretty.h" -#include "commit-slab.h" + +struct signature_check; +struct strbuf; +struct tree; #define COMMIT_NOT_FROM_GRAPH 0xFFFFFFFF #define GENERATION_NUMBER_INFINITY ((1ULL << 63) - 1) diff --git a/dir.c b/dir.c index ed262fa6e43..a7469df3ac7 100644 --- a/dir.c +++ b/dir.c @@ -27,6 +27,7 @@ #include "submodule-config.h" #include "symlinks.h" #include "trace2.h" +#include "tree.h" #include "wrapper.h" /* diff --git a/fetch-pack.c b/fetch-pack.c index 677102465a1..a9745bd9faf 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -2,6 +2,7 @@ #include "alloc.h" #include "repository.h" #include "config.h" +#include "date.h" #include "environment.h" #include "gettext.h" #include "hex.h" diff --git a/fsck.c b/fsck.c index adbe8bf59e7..3261ef9ec28 100644 --- a/fsck.c +++ b/fsck.c @@ -1,5 +1,6 @@ #include "git-compat-util.h" #include "alloc.h" +#include "date.h" #include "hex.h" #include "object-store.h" #include "repository.h" diff --git a/gpg-interface.c b/gpg-interface.c index 8615dcd4b4b..49d72c2066b 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "commit.h" #include "config.h" +#include "date.h" #include "gettext.h" #include "run-command.h" #include "strbuf.h" diff --git a/grep.c b/grep.c index d144b374894..e620e375b1d 100644 --- a/grep.c +++ b/grep.c @@ -4,6 +4,7 @@ #include "grep.h" #include "hex.h" #include "object-store.h" +#include "pretty.h" #include "userdiff.h" #include "xdiff-interface.h" #include "diff.h" diff --git a/http-push.c b/http-push.c index 637a4e91f7a..3f184986362 100644 --- a/http-push.c +++ b/http-push.c @@ -15,6 +15,7 @@ #include "setup.h" #include "sigchain.h" #include "strvec.h" +#include "tree.h" #include "packfile.h" #include "object-store.h" #include "commit-reach.h" diff --git a/log-tree.c b/log-tree.c index b5cf3d8439c..8861900b592 100644 --- a/log-tree.c +++ b/log-tree.c @@ -24,6 +24,7 @@ #include "help.h" #include "range-diff.h" #include "strmap.h" +#include "tree.h" #include "write-or-die.h" static struct decoration name_decoration = { "object names" }; diff --git a/merge-ort-wrappers.c b/merge-ort-wrappers.c index 2d1e8aa7ee7..ad2bb676e13 100644 --- a/merge-ort-wrappers.c +++ b/merge-ort-wrappers.c @@ -3,6 +3,7 @@ #include "merge-ort.h" #include "merge-ort-wrappers.h" #include "repository.h" +#include "tree.h" #include "commit.h" diff --git a/merge.c b/merge.c index da7fa652c27..10aaec3a6c1 100644 --- a/merge.c +++ b/merge.c @@ -7,6 +7,7 @@ #include "commit.h" #include "run-command.h" #include "resolve-undo.h" +#include "tree.h" #include "tree-walk.h" #include "unpack-trees.h" #include "dir.h" diff --git a/notes-cache.c b/notes-cache.c index fbcdfd0dfe5..14288caf98f 100644 --- a/notes-cache.c +++ b/notes-cache.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "notes-cache.h" #include "object-store.h" +#include "pretty.h" #include "repository.h" #include "commit.h" #include "refs.h" diff --git a/notes-utils.c b/notes-utils.c index cb88171b7bb..4a793eb347f 100644 --- a/notes-utils.c +++ b/notes-utils.c @@ -6,6 +6,7 @@ #include "refs.h" #include "notes-utils.h" #include "repository.h" +#include "strbuf.h" void create_notes_commit(struct repository *r, struct notes_tree *t, diff --git a/object-name.c b/object-name.c index 3cd5b327293..5ccbe854b60 100644 --- a/object-name.c +++ b/object-name.c @@ -15,6 +15,7 @@ #include "dir.h" #include "oid-array.h" #include "packfile.h" +#include "pretty.h" #include "object-store.h" #include "repository.h" #include "setup.h" diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index faf67c94d37..3d3fd380654 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -18,6 +18,7 @@ #include "commit-reach.h" #include "prio-queue.h" #include "trace2.h" +#include "tree.h" struct bitmapped_commit { struct commit *commit; diff --git a/parse-options-cb.c b/parse-options-cb.c index 26a4c7d08a9..be81158f861 100644 --- a/parse-options-cb.c +++ b/parse-options-cb.c @@ -3,6 +3,7 @@ #include "branch.h" #include "commit.h" #include "color.h" +#include "date.h" #include "environment.h" #include "gettext.h" #include "object-name.h" diff --git a/parse-options.c b/parse-options.c index b6803647d0e..f8a155ee13b 100644 --- a/parse-options.c +++ b/parse-options.c @@ -5,6 +5,7 @@ #include "commit.h" #include "color.h" #include "gettext.h" +#include "strbuf.h" #include "utf8.h" static int disallow_abbreviated_options; diff --git a/read-cache.c b/read-cache.c index b3e2917ddc9..d64d93bc364 100644 --- a/read-cache.c +++ b/read-cache.c @@ -6,6 +6,7 @@ #include "cache.h" #include "alloc.h" #include "config.h" +#include "date.h" #include "diff.h" #include "diffcore.h" #include "hex.h" diff --git a/ref-filter.c b/ref-filter.c index 594e66ad361..84eee904ba3 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -2,6 +2,7 @@ #include "alloc.h" #include "environment.h" #include "gettext.h" +#include "gpg-interface.h" #include "hex.h" #include "parse-options.h" #include "refs.h" diff --git a/reflog.c b/reflog.c index 9c094430884..57dc7c0d051 100644 --- a/reflog.c +++ b/reflog.c @@ -4,6 +4,7 @@ #include "reflog.h" #include "refs.h" #include "revision.h" +#include "tree.h" #include "worktree.h" /* Remember to update object flag allocation in object.h */ diff --git a/refs/debug.c b/refs/debug.c index adc34c836fc..6f11e6de46c 100644 --- a/refs/debug.c +++ b/refs/debug.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "hex.h" #include "refs-internal.h" +#include "string-list.h" #include "trace.h" static struct trace_key trace_refs = TRACE_KEY_INIT(REFS); diff --git a/refspec.c b/refspec.c index 68020ee84c6..2ddea205d10 100644 --- a/refspec.c +++ b/refspec.c @@ -6,6 +6,7 @@ #include "refs.h" #include "refspec.h" #include "repository.h" +#include "strbuf.h" static struct refspec_item s_tag_refspec = { .force = 0, diff --git a/revision.h b/revision.h index 742700504a7..6630bb2eae2 100644 --- a/revision.h +++ b/revision.h @@ -8,6 +8,7 @@ #include "pretty.h" #include "diff.h" #include "commit-slab-decl.h" +#include "decorate.h" #include "ident.h" #include "list-objects-filter-options.h" diff --git a/send-pack.c b/send-pack.c index 351037b07bc..e68da24cc52 100644 --- a/send-pack.c +++ b/send-pack.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "config.h" #include "commit.h" +#include "date.h" #include "gettext.h" #include "hex.h" #include "refs.h" diff --git a/wt-status.c b/wt-status.c index 97b9c1c0359..068b76ef6d9 100644 --- a/wt-status.c +++ b/wt-status.c @@ -22,6 +22,7 @@ #include "strbuf.h" #include "trace.h" #include "trace2.h" +#include "tree.h" #include "utf8.h" #include "worktree.h" #include "lockfile.h" From patchwork Sun Apr 16 03:03:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212696 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC4ABC77B71 for ; Sun, 16 Apr 2023 03:04:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230260AbjDPDEg (ORCPT ); Sat, 15 Apr 2023 23:04:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230179AbjDPDEN (ORCPT ); Sat, 15 Apr 2023 23:04:13 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A10D3C15 for ; Sat, 15 Apr 2023 20:03:43 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id gw13so12113876wmb.3 for ; Sat, 15 Apr 2023 20:03:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614221; x=1684206221; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=hA5UfHMctKekDPwKcFA+N+t+HiWPoN5Gn7rqJ+1psEM=; b=Xzel18txI/bU16G1xAKurS0AFVhgGtwdMu7t+dgYHE7WzmCvq8Yeel+BReSg52ePdk XcIEJ7vtxfxIZCbQqocblwnskMN4IpBJS8g5TxeSRsQc5ESr7736vkKyqrmMi+Ufzev/ p/E8tw4DuFxQm8VPhouFdzvurj1nlA7oD2sOAFbLfFU5y++5MNFWtMnFwccORPyO1Rj9 6r2omI/UxCNzagsINXlFsS1WS4dKCecGGWjRb3e10t6XeKyA4pfOtvwjALLlMEPTONqD +hv69vH+IXYtfHlpANu3wNN7Om0dGhjMmQj59bNMNUa6ShPHE3LShQRF+++iqxjjw7Ra YpJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614221; x=1684206221; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hA5UfHMctKekDPwKcFA+N+t+HiWPoN5Gn7rqJ+1psEM=; b=FsxcGB0UsWSeZleVt5NbDQokiTLXsjtKRLjEDKDWOBPHhNn2BwOy3qQLuhZ2H3GpmY lYO1Jgjz0TI7dVlrWI/t5QYqG39O9UgFZ3iJiGpQmk9vHtXZKY8sMVo2LAgH74C755NO GpoK4FnFtAIEP1Tlc+GuSwJfCqk1tafb1Ix+2EHaZl8ys5Uq436RizPk+gMndcg+6N6o eLa2OXU3JExeANca5vK/8hi1h2ZO5lHFIASPkW73lUVWOLmNILz8UiIon9ato6Fn1+Ug hbLVuFIm/dIqyTHvqYVhtvb2aGxbExbm5ZPquFIKdmOnwLB3kpUyk80ROyleYnr9Ntpi wEAw== X-Gm-Message-State: AAQBX9dW5T0tKUtDiKcn2vNkN9UOyZTt6rPpIWDb/3ElJtaEqGGuRNc8 44W8hzwp9812InGO8i5eX2A4rMhQbpA= X-Google-Smtp-Source: AKy350bY1WLKvMTJVWOOaplpz3GA6kYuRsBlFC/Uz3PpVCYg9y6/kEMaRcWZC+Uv29SfJ7gFC/A8Zg== X-Received: by 2002:a7b:ca50:0:b0:3f1:661e:4686 with SMTP id m16-20020a7bca50000000b003f1661e4686mr2724904wml.7.1681614221325; Sat, 15 Apr 2023 20:03:41 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id j4-20020a05600c1c0400b003ee8ab8d6cfsm11927275wms.21.2023.04.15.20.03.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:41 -0700 (PDT) Message-Id: <1aa36d91b596522ba01d24b50149bb507e697958.1681614207.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:23 +0000 Subject: [PATCH 21/23] object-store.h: reduce unnecessary includes Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- object-file.c | 1 + object-name.c | 1 + object-store.h | 8 ++++---- submodule-config.c | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/object-file.c b/object-file.c index 8e0df7360ae..921a717d8a5 100644 --- a/object-file.c +++ b/object-file.c @@ -38,6 +38,7 @@ #include "packfile.h" #include "object-file.h" #include "object-store.h" +#include "oidtree.h" #include "promisor-remote.h" #include "setup.h" #include "submodule.h" diff --git a/object-name.c b/object-name.c index 5ccbe854b60..88d839f70bc 100644 --- a/object-name.c +++ b/object-name.c @@ -14,6 +14,7 @@ #include "remote.h" #include "dir.h" #include "oid-array.h" +#include "oidtree.h" #include "packfile.h" #include "pretty.h" #include "object-store.h" diff --git a/object-store.h b/object-store.h index f9d225783ae..23ea86d3702 100644 --- a/object-store.h +++ b/object-store.h @@ -2,16 +2,16 @@ #define OBJECT_STORE_H #include "object.h" -#include "oidmap.h" #include "list.h" -#include "oid-array.h" -#include "strbuf.h" #include "thread-utils.h" #include "khash.h" #include "dir.h" -#include "oidtree.h" #include "oidset.h" +struct oidmap; +struct oidtree; +struct strbuf; + struct object_directory { struct object_directory *next; diff --git a/submodule-config.c b/submodule-config.c index 7fc0812b644..58dfbde9ae5 100644 --- a/submodule-config.c +++ b/submodule-config.c @@ -12,6 +12,7 @@ #include "object-name.h" #include "object-store.h" #include "parse-options.h" +#include "thread-utils.h" #include "tree-walk.h" /* From patchwork Sun Apr 16 03:03:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212699 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 039CEC77B70 for ; Sun, 16 Apr 2023 03:04:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230293AbjDPDEr (ORCPT ); Sat, 15 Apr 2023 23:04:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230185AbjDPDEN (ORCPT ); Sat, 15 Apr 2023 23:04:13 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE3E335BC for ; Sat, 15 Apr 2023 20:03:43 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3f16ecaad2eso2701915e9.1 for ; Sat, 15 Apr 2023 20:03:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614222; x=1684206222; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=OHCC7pl/0MUm3RZQQbRwL8UeA/97RAGRt1GddcT9luo=; b=jAhOYTVHzKaRRmp7UOKn+9m7t9bjydOj5KBGj7nuhZlaHox+f83pGLyrTGl2STqtvs 0kkNDJu00LzWhHT8NOvkCKLFD/DAPIKwCHi7g/pEofxLUEJxwJI3ZIGg1pQmiSQnOzYQ oUgN5VSac5yg60uCl+6ZMJYzuQrZObcbcfoAs686FdkbJsMmHXXHrKQeqmKyq1hEbiwt 2ThXnjGcScTndjNwuvFEI8y4hGM4NP3mo1ubZn1Rbmf+GUbisN9Jnx1MH9b8YGjhJXXD i82CvVsqJIuS686riAZmQ+QDOrTw5yixUUebsrlnLhNzoZb4Tz0IMNUsVYLOHvhCoS1A tnTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614222; x=1684206222; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OHCC7pl/0MUm3RZQQbRwL8UeA/97RAGRt1GddcT9luo=; b=k4bLcvuwAIULezI8GCo0NNe+f6XZWfSDBgUmANd2iG6ooC7RKGLemB9nPv1hKec9c1 UXXK+m0xxofue1PZmwuyGi6G+IlyDAaODsP0oTD2ePr7hE0c7Ph34Eymi9RskUzB29fJ wmnyuTB4LRS99cJ6weQG7jVdpp2TzATCFhglW+jynOECHmzQqI+gzwJ2sqtATlEhal+V RzvdAY1Cmy7odcUgl/7cpz9JMObWtcs8LOUKnL0xy8QbQKR8dqcnJwJ8bQuDN6Ozsz9e XnsKuk9hBBoigJHeWPdVN1jaZjiBVogrxtxACAbOrmec+uwpcBet/KHQhxP4PiBFSvLt pt2g== X-Gm-Message-State: AAQBX9e2kZgWMJjMVeUKgV+jIs1YF7OLMCUGEe1OnSPUfnvCljCjdF8/ zBLI/O2XLRgIeDgeDDzDAAcxm0NydUw= X-Google-Smtp-Source: AKy350aS+gXz3Mg0ASVRUADkAUDMnPQvRD+2k/4MNaaBVCd8ZYQ7+oKd9V6O1aLgq4nVFxDmVw/org== X-Received: by 2002:adf:ef83:0:b0:2f8:4d7c:c3a9 with SMTP id d3-20020adfef83000000b002f84d7cc3a9mr2546751wro.43.1681614221944; Sat, 15 Apr 2023 20:03:41 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id h19-20020a05600c351300b003f046ad52efsm11826468wmq.31.2023.04.15.20.03.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:41 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:24 +0000 Subject: [PATCH 22/23] diff.h: reduce unnecessary includes Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- attr.c | 1 + diff.h | 1 - http-push.c | 1 + line-log.c | 1 + pack-bitmap-write.c | 1 + reflog.c | 1 + tree-diff.c | 1 + 7 files changed, 6 insertions(+), 1 deletion(-) diff --git a/attr.c b/attr.c index 2d8aeb8b58c..ddf2b0cbc2e 100644 --- a/attr.c +++ b/attr.c @@ -20,6 +20,7 @@ #include "object-store.h" #include "setup.h" #include "thread-utils.h" +#include "tree-walk.h" const char git_attr__true[] = "(builtin)true"; const char git_attr__false[] = "\0(builtin)false"; diff --git a/diff.h b/diff.h index 53aeb02a54b..69e574f4315 100644 --- a/diff.h +++ b/diff.h @@ -4,7 +4,6 @@ #ifndef DIFF_H #define DIFF_H -#include "tree-walk.h" #include "pathspec.h" #include "oidset.h" #include "strbuf.h" diff --git a/http-push.c b/http-push.c index 3f184986362..866ba243a89 100644 --- a/http-push.c +++ b/http-push.c @@ -16,6 +16,7 @@ #include "sigchain.h" #include "strvec.h" #include "tree.h" +#include "tree-walk.h" #include "packfile.h" #include "object-store.h" #include "commit-reach.h" diff --git a/line-log.c b/line-log.c index 10c19daec4a..6a7ac312a43 100644 --- a/line-log.c +++ b/line-log.c @@ -18,6 +18,7 @@ #include "setup.h" #include "strvec.h" #include "bloom.h" +#include "tree-walk.h" static void range_set_grow(struct range_set *rs, size_t extra) { diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index 3d3fd380654..cdffe2ce47d 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -19,6 +19,7 @@ #include "prio-queue.h" #include "trace2.h" #include "tree.h" +#include "tree-walk.h" struct bitmapped_commit { struct commit *commit; diff --git a/reflog.c b/reflog.c index 57dc7c0d051..ee1bf5d032c 100644 --- a/reflog.c +++ b/reflog.c @@ -5,6 +5,7 @@ #include "refs.h" #include "revision.h" #include "tree.h" +#include "tree-walk.h" #include "worktree.h" /* Remember to update object flag allocation in object.h */ diff --git a/tree-diff.c b/tree-diff.c index 9ea2dd7a6c3..20bb15f38d9 100644 --- a/tree-diff.c +++ b/tree-diff.c @@ -5,6 +5,7 @@ #include "diff.h" #include "diffcore.h" #include "tree.h" +#include "tree-walk.h" /* * Some mode bits are also used internally for computations. From patchwork Sun Apr 16 03:03:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13212700 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D4A0C77B71 for ; Sun, 16 Apr 2023 03:04:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230188AbjDPDEv (ORCPT ); Sat, 15 Apr 2023 23:04:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230198AbjDPDEP (ORCPT ); Sat, 15 Apr 2023 23:04:15 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20A253C13 for ; Sat, 15 Apr 2023 20:03:43 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id he11-20020a05600c540b00b003ef6d684102so10093094wmb.3 for ; Sat, 15 Apr 2023 20:03:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681614222; x=1684206222; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=v5CU5Bc3XP5YbogCT5M88UNwd1365uiEQvjRGnUczek=; b=WyF7GekcLZlDUSIFu9kmAKdWVShhmGSuji9hUXzoopSNtoP8UHee9qwV+pFsxTKQye smpeK2A7C++UcMIh+TIdN5UTQlECzcxnWTwz/XZuXRfqlfw2pd2ldbmSYSzD2IK4SAOz OaxiFNIhH/n9n47WFty5t4Ryly8kN/0g0uZRP+1JqdBULo6oNQnhFk4QJPMCtSC7OzIN gC2Ut5VYFjcMHr6zCbJx/GS0GV9DzSvLjC1XC9gv0/Wq6yaQrWagCvMDxwu3x/MGFJpY Dgc+5ujuph9Wp/RTv5KCUsgBJqoaleX3eF92PGDr4FzHrnFI0XzbfsZlO3pRbm25CQhn XsRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681614222; x=1684206222; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v5CU5Bc3XP5YbogCT5M88UNwd1365uiEQvjRGnUczek=; b=LDqodoHY//4nFdEYNb02ac8YSc3rPMptL66eiwiaZpkxgkPyvDN69+1Kd06kOJFUQ6 P5XgFSoX/m+cBi0SUxhJs9AyZNJsNSDV0KeX/Gn6sEuQIzLim0u6jRPR/+JvZnFz4OUF P3Rt5C+UGjEXuN5uJtb7X951neyL8n6bYjEdGVMKRej/bzwDErd4RmOogeWkdctSN1Tk Wogc9Vv7nOyHHlPdYdrxAvdZkZIE5YZtEhj33JdazSiPNvxw+pt8pvdkHVctqqu9kjZb aw2OuTL+68jabnwXhmofnOzbHPY2ouHmjzaR5mNJJL7MFfLmSvemzsoj99o9VjNjpGy7 h9Bg== X-Gm-Message-State: AAQBX9dWFHb0OAdQ+Q3U1y6Rx68XFvN3FDFk3trsvUfyqIr2Ws+n58Qf YmoMT5SyNXNjVwaOiApz8/oCmP5B9DM= X-Google-Smtp-Source: AKy350YZRxWjF7v09evH02gj+qOI3ZWtit3SdvIZbRY90CUZqIcGG1cJfFQI4g8wAP8+L7waLHoWPQ== X-Received: by 2002:a7b:ca56:0:b0:3ee:6cdf:c357 with SMTP id m22-20020a7bca56000000b003ee6cdfc357mr7362272wml.20.1681614222596; Sat, 15 Apr 2023 20:03:42 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id l21-20020a05600c4f1500b003f080b2f9f4sm11791935wmq.27.2023.04.15.20.03.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 20:03:42 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sun, 16 Apr 2023 03:03:25 +0000 Subject: [PATCH 23/23] reftable: ensure git-compat-util.h is the first (indirect) include Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- reftable/error.c | 1 + reftable/publicbasics.c | 2 +- reftable/tree.c | 2 +- reftable/tree_test.c | 1 + t/helper/test-reftable.c | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/reftable/error.c b/reftable/error.c index 93941f21457..0d1766735e8 100644 --- a/reftable/error.c +++ b/reftable/error.c @@ -6,6 +6,7 @@ license that can be found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd */ +#include "system.h" #include "reftable-error.h" #include diff --git a/reftable/publicbasics.c b/reftable/publicbasics.c index 0ad7d5c0ff2..bcb82530d6c 100644 --- a/reftable/publicbasics.c +++ b/reftable/publicbasics.c @@ -6,10 +6,10 @@ license that can be found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd */ +#include "system.h" #include "reftable-malloc.h" #include "basics.h" -#include "system.h" static void *(*reftable_malloc_ptr)(size_t sz); static void *(*reftable_realloc_ptr)(void *, size_t); diff --git a/reftable/tree.c b/reftable/tree.c index b8899e060ab..a5bf8809854 100644 --- a/reftable/tree.c +++ b/reftable/tree.c @@ -6,10 +6,10 @@ license that can be found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd */ +#include "system.h" #include "tree.h" #include "basics.h" -#include "system.h" struct tree_node *tree_search(void *key, struct tree_node **rootp, int (*compare)(const void *, const void *), diff --git a/reftable/tree_test.c b/reftable/tree_test.c index cbff1255886..ac3a045ad4a 100644 --- a/reftable/tree_test.c +++ b/reftable/tree_test.c @@ -6,6 +6,7 @@ license that can be found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd */ +#include "system.h" #include "tree.h" #include "basics.h" diff --git a/t/helper/test-reftable.c b/t/helper/test-reftable.c index 1f0a28cbb64..00237ef0d9e 100644 --- a/t/helper/test-reftable.c +++ b/t/helper/test-reftable.c @@ -1,3 +1,4 @@ +#include "reftable/system.h" #include "reftable/reftable-tests.h" #include "test-tool.h"