From patchwork Sat Apr 22 20:17: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: 13221077 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 0BC96C7618E for ; Sat, 22 Apr 2023 20:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229838AbjDVURk (ORCPT ); Sat, 22 Apr 2023 16:17:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229565AbjDVURj (ORCPT ); Sat, 22 Apr 2023 16:17:39 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B9621BE7 for ; Sat, 22 Apr 2023 13:17:37 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-2eed43bfa4bso2711504f8f.2 for ; Sat, 22 Apr 2023 13:17:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194655; x=1684786655; 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=KvjKXZ+lhHweQ1CkNYakUEu8/fyi12tL91xzjPg3Fje16ZMllZFKTQ/gXAjYIlqVWe EuXSh5g09fklET9LxOVfuWSyzWmIozzIk9FDexqsXgrsWceKwVrtlP/C+o1iVocurOfw 9VsrETUAo7bRaxpZhKywepjACbziKGs5IJ4hjOAsnnMowu49UQL/pykGaMFeDQc6GqSb AlmQnz6em2DMcAryniNh2n47UEQy6A5a9hTF7xyh/ikIzc9R9ZBsiuB9cZ6qh5EU2V+5 BLcEia/n+GYqglOcsbP35vUxRkLdgzQIXHqQ+rL8anoKa8lo7M81bUEdvkz13VsjN2VH Pqyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194655; x=1684786655; 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=BNyqE8WivrSH5HF2nCTTlF8twd/w7ncgmcQPq8CBQWJZwmo9N8vMSNVQGRrLUUkEC5 apaB1teVdk/of2V8GaDJ+61znvWKcAOvw2QXyx1OJscOxZXbUwLyl3XXDALP8QH18gi8 q8m4CI15mYjIrm/ffP1zpaoimBIQ7tSInsUH6QlMF87zFAjNyukBTLeyeV7JTYd/l6G5 fYJpcXPcC7VdhwJDr7Z9SJgl64i7QJC82TO9LP3HNvE/WCcehgqqiekqVVR7UWh0Larz L2/PXytSSqCjsChBDZVRzXCeqa7lu9ge1+uT/dfZcD6fqLHAPInnsJtjB/Qw6clXVsV+ kZGA== X-Gm-Message-State: AAQBX9fuco1FfXMvkASRGj5BURQaCemYNy9ZVu2CZ60alklGgeHpdV2O crK5h+dRTrEdUj4lcX4KU8EpV0u/B/Q= X-Google-Smtp-Source: AKy350ZLNNV2W/YewVRqRGyIwhecP5J/kXJfgguZ2PRfZWE2tNxqUAvPT6gXZ9h6Qc1A4NVtxhacFQ== X-Received: by 2002:adf:db4e:0:b0:2f2:3dbf:6922 with SMTP id f14-20020adfdb4e000000b002f23dbf6922mr5597074wrj.22.1682194655574; Sat, 22 Apr 2023 13:17:35 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m7-20020adfe947000000b003011baf89b3sm7229349wrn.40.2023.04.22.13.17.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:35 -0700 (PDT) Message-Id: <1341ae8125eb23e7d469a5b3c79e3dee2d230537.1682194651.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:08 +0000 Subject: [PATCH v2 01/22] treewide: be explicit about dependence on strbuf.h Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Derrick Stolee , Elijah Newren , Glen Choo , 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 Sat Apr 22 20:17: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: 13221078 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 EF387C7618E for ; Sat, 22 Apr 2023 20:17:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbjDVURm (ORCPT ); Sat, 22 Apr 2023 16:17:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229565AbjDVURk (ORCPT ); Sat, 22 Apr 2023 16:17:40 -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 6F0C81BF0 for ; Sat, 22 Apr 2023 13:17:38 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-2f917585b26so2723977f8f.0 for ; Sat, 22 Apr 2023 13:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194657; x=1684786657; 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=oRbXvIUTiK9IA6w/UEdG2n6tqOzY+Y9znfe+E5mXp/A=; b=od374OpPcQ2LpeU8kQtEXzudkjHQftQ9RUdli9+CtxHTo8BKdzoQC0wMLBN2RyFoMg 1gFdzC1qmJ+mFHrt5mU6Eck050RaUsk2L2+c+MpbT4w1umQUw0qHf9JINTWanvYbpIjE SkMdWhK6L2mCxXTRkcTMJO1tPxkap7Yim/y9uMoCv5YbaBdngjLukVOZeLQGuVKY/MHK sCZ5E9Lqqt+GFIclPIMg7R9ipcJvbDpY8ZctBVcfznsbPOELcVCW5oR6aLXQ1c1VOhnY w/cgz4sZhuBSq9Zi1gvxfBXXhog7m9z5OfUjX8V0emJEPQhApnrv3yC+29K5EjcMt53w MjPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194657; x=1684786657; 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=oRbXvIUTiK9IA6w/UEdG2n6tqOzY+Y9znfe+E5mXp/A=; b=W/okRfbFlWJGyCu8FnC8/+oFDHkKaXTruqZIGUrmOACK8QM7aAB7ReGXm/n5Qc1XM9 Xwn4MHnNBi2p6xlJ8jmYC0bt5P5Ujb0bpXS6bl4H4KHx9dosKc64WsZomVlYfepI3IiP Hs6PDdwUC8u/xPH+1aQCZOwYxmq8bu51TJRpy/KZJMPkUwLfqCaBwnp3fVQR9h5GvcM9 uT//Vt1sZbsOqIj6gR9YWzTADWt+06Ebxx8eYMh2cqdnDGpLRpNm8bOOvRDK1YsGJNaz H+rn4PwSbFLD4m2xW4TNv0u8ftHeMkVKKfzxDlI5EPYVweKKlq0QDXpFdDhE7XZTfeXE poJA== X-Gm-Message-State: AAQBX9ejhvHrJ+F+ktf9etsev87wTJpZikpWycZnPGtTz8ZvJsgGz7vy y/SQaK9tpH7AUycULcePOSjvO0QnbTE= X-Google-Smtp-Source: AKy350alDSyzOnv1Ez6tcjcGVEwf3p0UV84rEIlER08NUK9Vz/trBD9paCtnZEse7+5KWJHlJ6lIRA== X-Received: by 2002:a5d:6b04:0:b0:2f6:121a:c1d0 with SMTP id v4-20020a5d6b04000000b002f6121ac1d0mr6535507wrw.19.1682194656466; Sat, 22 Apr 2023 13:17:36 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m10-20020a5d56ca000000b002c54c9bd71fsm7197733wrw.93.2023.04.22.13.17.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:35 -0700 (PDT) Message-Id: <4a1f197e1e09e0941ce4a3b658cd199df52eeee5.1682194651.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:09 +0000 Subject: [PATCH v2 02/22] 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 , Derrick Stolee , Elijah Newren , Glen Choo , 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 71e2fe74c4f..ffec289dc5d 100644 --- a/cache.h +++ b/cache.h @@ -593,28 +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 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 Sat Apr 22 20:17: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: 13221079 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 EF74DC7618E for ; Sat, 22 Apr 2023 20:17:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229898AbjDVURs (ORCPT ); Sat, 22 Apr 2023 16:17:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229839AbjDVURk (ORCPT ); Sat, 22 Apr 2023 16:17:40 -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 D9CF81BF9 for ; Sat, 22 Apr 2023 13:17:38 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3f19afc4fd8so3324795e9.2 for ; Sat, 22 Apr 2023 13:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194657; x=1684786657; 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=p+clux+eXJTYbU79FT4wVuKLg33sWByuGpiqA+U86KDBwrr5QufS8MQZihKrMhyixN uXI22f5TTQyTr2Cac17WLmHDZnVak6QfqVJcw5UoZqrQaSCfYXvp5hHmrBiHvfJIlXp/ l26clhNFlWF5SADnCwfXIZlBToaMaVzgP6vXKtCv6qbnEnN9/q+LbM3OUFmkjh9rTbRu 6/rARB9nE9prcpAK40UnOrfmnFyzFQsK+VJU8OybQhyfJScsGk5usGZDjFtyuGz+bQ8Z h+NOALUkCQi2/SXtm76GnxZsFu2+kb2LY77Xp/Gnax0DUbIf50rEaRAyaUyiYaO+Dvj6 5gGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194657; x=1684786657; 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=THQyxksDl6X6dtaP4Cjrghi76SU+CgHEZCH05NaT/AIsvDu6ni3HbgEwAraKr7ftFL X6/lgBkCwdgFWG9x1dq18KKLwgJLAxi6Y1WtzSD/gJXpV+hjNB49SRvHLNIQGKXsZN7L q94HVhoIMcCfNDOX2PB/27Nf+6lKdBGjsLvchysA/23JeZq7c01CxfeArA9XRfTDGyep c/FjbBVOny134n26UPlfXR1OCJjCd7jv8tC8YaweDfc+IHV6uL731wReF/Mp5gfe8Dx4 bDzgmhqMXy38F9SLyVZpROpi2Ldmg2B/nPIDXVRl349TPqTw08QB2YSDUjKqv07l9Ytl m/0g== X-Gm-Message-State: AAQBX9fNO1AMY3kG5li8FO4G1Ro63YGvU661eH17UjomVvdZG6RPiy7h HC723LTTrbX4EDhL/EDX3rp5TMtVdp4= X-Google-Smtp-Source: AKy350YatYioEcFPD6dQaamjJyTEdUIOuoufvr/9yo1NjzVwdFek5sq2qpMZGWivk2Whx7zRcX5qOg== X-Received: by 2002:a1c:f602:0:b0:3f1:7a50:dd66 with SMTP id w2-20020a1cf602000000b003f17a50dd66mr4749732wmc.27.1682194657019; Sat, 22 Apr 2023 13:17:37 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id i40-20020a05600c4b2800b003ee6aa4e6a9sm11340016wmp.5.2023.04.22.13.17.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:36 -0700 (PDT) Message-Id: <99dfc5eb5dc1db367feeb90f668d32f4133fb044.1682194651.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:10 +0000 Subject: [PATCH v2 03/22] 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 , Derrick Stolee , Elijah Newren , Glen Choo , 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 Sat Apr 22 20:17: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: 13221081 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 35173C77B78 for ; Sat, 22 Apr 2023 20:17:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229950AbjDVURx (ORCPT ); Sat, 22 Apr 2023 16:17:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229841AbjDVURl (ORCPT ); Sat, 22 Apr 2023 16:17:41 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EC371BE7 for ; Sat, 22 Apr 2023 13:17:39 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3f192c23fffso11421125e9.3 for ; Sat, 22 Apr 2023 13:17:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194658; x=1684786658; 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=EQIKp5Kkscj9UUhyOXE+gDcYwOZmiCVJIqo3Qo59TDpYSbfUzn5SidCA1nfmSwov9j 6cdziOfEk+NQNpCmFcaJM4SqgktfVVY+AKAdLFlJjN7YK94vdnnk5e8n8+lj0oyvxpZW t1fub27Y2K3KynDbFz+ay/QFZmN8JcCen/ZJD5WnRYUJUiZMrQMrEkZhM2oV9kIxC2hs 1thTNavof6TRFbcAmawEuzX2v2H68ZUT7CVLf/OuE687VADn2bFH20/fNcS5uFixhXKr leSArJ3Suz/jO+ZL2BzvuvTAuaq4vKYOkRehKamvvS6jotybuUrfHa2To5CO4joLbMTO Yblg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194658; x=1684786658; 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=EZFAYHzYYlN5+xrnqKh/H3G6hqTm8ATYTfpVkIajju2JhSOQfd1QGDtGjDQmyuHXkj s+1+rqczAY0i7eoHwbeKPg10I/2rYfNJ1ITdYT/gq3Zo0TMzD7aH4irNWPp7wCuFbGRZ 1IfpRdYp3FedFmdbqJAZBzlxypZI51opcrdf7JBvVlR+Jb5RjS/6k+qYOHx/7xrqHZ6e TY6dBDBq8kKCLgMgQL4isQFSHek/G2nQ+YM6NwO3wvMVxQKKMIF6//UkO1GsckeazAE3 /2mnqqBmffbbO2gHp9Oi6k/BcbKafjz0DLSpPbMpBUi7A+xoaQ/EVZlq0JnsCHLo4aVf Tgkw== X-Gm-Message-State: AAQBX9cvZ43xISzVEv3V9maXZYuvjR8y48j7ZpvCcm7JT7ZJ7zsHFunq H6R5OakihgmZyx8ECx2JpFBKQJpkyYs= X-Google-Smtp-Source: AKy350ZMgoncrDophgHhRtUVZnzOLM3tQVNg4LNSg+AbZWc5czsfXfnhAVdVUUjz8WKLzjFT2CBTAA== X-Received: by 2002:a5d:6591:0:b0:2fb:1a68:1d96 with SMTP id q17-20020a5d6591000000b002fb1a681d96mr6157031wru.15.1682194657759; Sat, 22 Apr 2023 13:17:37 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id f12-20020adfdb4c000000b002f9ff443184sm7204805wrj.24.2023.04.22.13.17.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:37 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:11 +0000 Subject: [PATCH v2 04/22] 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 , Derrick Stolee , Elijah Newren , Glen Choo , 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 Sat Apr 22 20:17: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: 13221082 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 20E9CC7618E for ; Sat, 22 Apr 2023 20:17:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229931AbjDVURz (ORCPT ); Sat, 22 Apr 2023 16:17:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229846AbjDVURl (ORCPT ); Sat, 22 Apr 2023 16:17:41 -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 5C8BD1FDF for ; Sat, 22 Apr 2023 13:17:40 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3f19afc4fbfso6308195e9.2 for ; Sat, 22 Apr 2023 13:17:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194658; x=1684786658; 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=PoaODrtvJfqvjGb0ro6VAhMs2auvs5XI+2fPm+bYI8aUK6X3LSiQ9HX6YCm2dy7xsr QARdcWwgXITIHS9EZqC9C3Xdc7XhaBrg/TV6Xh+36a1VvZnPGJEtSI99Ax5niQTuGomY rRuBVpAnNxo5agpEUqwTG27iQldjdx8KThJM2bdzfxUeSe4JKRb4MdYQwhhsehLgInDF Zk9ZjTWDVYjYfyCvhqf1uCYPYqFcjuk9PDo28dUmbB7Vli8lu/wxrLmH2LIFU6Z42Gx9 DwHYEgjDc1vrUe+HEqcWyXN+jDSpg/vZrs0uS5xDkrv4etXBZiHOrmzz4M17F+pOVZnq sxRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194658; x=1684786658; 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=YT6C6CceaUQV/O2Z59j+rJJDd/qx4dkSSFlyOAe1lf1VeG6zcWPX6feYi97uSDXFKs VICr+YMzDu5tvq7HtnYhlE95Hy3qcjANXYn5fn/96N/EO/EsXGomuImf8xA/ut/2ZdSm p2QLT72T7lh0/fvvfXOxE3oMw4PVD0lKtLVpWwSYnlQbvW6fQ75EKjhc3SzQWAgSpdnQ wIXxbY29vzKK2v7t2KJJ+TMleUcpyYmAJ3WYnw/AJ43PYrS+vn9x5nfR7NCtpbO32CIZ D8k+vgZ9/iG8MCtykMRCuCIL6D93u06v/oq9/c88d8iid38Tmezo6x5lGY5zlSpCYOMj whFg== X-Gm-Message-State: AAQBX9eCCEJ478xA1fLiuJI47N06absFfG78EMexZmPMtHHD1Fug1RSJ rkHjfHSnAOwM5cPJa1ZZD7+JugBsQCE= X-Google-Smtp-Source: AKy350ZeOOJhxx7ZGs5VCKhTbqH8A/YYOrVhMJKNed4j7oE8cFKkpU56L0IzbFCmXiKNx+yRwnsEbg== X-Received: by 2002:a1c:f309:0:b0:3f1:80d2:2dff with SMTP id q9-20020a1cf309000000b003f180d22dffmr4542621wmq.26.1682194658457; Sat, 22 Apr 2023 13:17:38 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id c16-20020a05600c0ad000b003f198dfbbfcsm2377385wmr.19.2023.04.22.13.17.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:38 -0700 (PDT) Message-Id: <513ffafa597f18363bdcd308cf8159c21e66ecb0.1682194651.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:12 +0000 Subject: [PATCH v2 05/22] 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 , Derrick Stolee , Elijah Newren , Glen Choo , 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 Sat Apr 22 20:17: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: 13221085 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 74D84C77B7E for ; Sat, 22 Apr 2023 20:18:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229964AbjDVUSA (ORCPT ); Sat, 22 Apr 2023 16:18:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229866AbjDVURr (ORCPT ); Sat, 22 Apr 2023 16:17:47 -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 ED6501FE3 for ; Sat, 22 Apr 2023 13:17:40 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3f086770a50so19370725e9.2 for ; Sat, 22 Apr 2023 13:17:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194659; x=1684786659; 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=Mg5Z4PQOL0p5Ef8mXTykwakWEIMe1eWTXiVnYwXgTfXDFp2n2uQiIR01TUvcL9lmrb 6JzIEiaf0g+ixG1e3fZUI1YR6lMa9BLcblOXU+QGbeBZyqH3ZuLlB2ItwixMaqzINVnY FUzuUJG/RBRWd9X2VmgAaDMZomnMt/9pEJVQdZBqxjQzqSnwjy1xjvSvG3v0OT6qjQq6 0/3VYyqBOzQImzwKsDMx31GurhwSoptl/Nkp8cfFylpfbpBTw3wXAJKDdINE3blfW2eY 1usvZsInIEWSp16clTswdsaLW4LD+u2ygQi/nW1NI/JTLnulDTuZ6OcovE8nNTwFC/+z T5Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194659; x=1684786659; 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=Ohvb0IPxSYXiWVmVkPGtclT5vgjdRsBJd6iHjY/+SQ65te9rqKg68pH6RT76TCyjXb 0iz41dnYbA4d/PTmffiPFezyWsPbv2eW0buK+7JSbLC+bkiD42rENGCidmRrEmVECJz8 py7ol4f31a6uMsYCEZXr5MxCYIW0BgdDsc+BD6WBmwj5x+py6pRCnlH4cqmjW9D+RFQW aZX/63/FqFIaVXi8pPBUZif8/XiIlL22KpXmz6vUELjMiQ3i8a9CrJSpUz5EMjC2M6rs leq3RtitdLraDU0VS5vuAw6Y8W66tFxHsQj21USQpRGeBJHTwPauVUTWl7pAytMxZ4zI eHeA== X-Gm-Message-State: AAQBX9d3zhFzVYXHIozcapyf12qXTiq2A3sF6mfb8KjRhOKqXUSy4vxC 3ZZlR8Vtz2zTmERhyUObO+X3Eq2dGuE= X-Google-Smtp-Source: AKy350YEYb7UsugqHPlJhq56eFA0QPbDT5UiThagN8J8ZCEjvVrVnTURiZ0Z2gWy7faH8nmfcSVDdg== X-Received: by 2002:a7b:c7ce:0:b0:3ef:f26b:a187 with SMTP id z14-20020a7bc7ce000000b003eff26ba187mr4473002wmk.0.1682194659009; Sat, 22 Apr 2023 13:17:39 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id g11-20020a05600c310b00b003f0aefcc457sm11484035wmo.45.2023.04.22.13.17.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:38 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:13 +0000 Subject: [PATCH v2 06/22] 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 , Derrick Stolee , Elijah Newren , Glen Choo , 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 Sat Apr 22 20:17: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: 13221080 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 91A91C6FD18 for ; Sat, 22 Apr 2023 20:17:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229947AbjDVURv (ORCPT ); Sat, 22 Apr 2023 16:17:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229851AbjDVURm (ORCPT ); Sat, 22 Apr 2023 16:17:42 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F395A1FEB for ; Sat, 22 Apr 2023 13:17:40 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-2fe3fb8e25fso1759944f8f.0 for ; Sat, 22 Apr 2023 13:17:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194659; x=1684786659; 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=mGDoaAWYcxgK2PrNY2+7sOAjlypcIpL2T70aYt1IacVZR3US/WJdsFbJQVERSQIZ9M hnzdSoQ36zsVNzPZPLhiaSudMHsPpRSwCEWOwElKm1UV1/O8ow/xxTs2Eygk2y8fabkX o6gAzz2K/iX1zmSkYYBKSBGLXBPGH1cOoqxIEParbl6tTG0Df7K/eHLXqimGEU0K2z3V +D3s6Svm611FpsiE0r1yxxIZIJVV8sRxj0vqtwhlmmDtG0pUrSlHmE7xDsTTd0y+g6L+ 5QgvMCy9QVPS+HiLLNnqUdPf0Gk4xZuXX9SITUbLSWTtHmENDKR8jZjdOODtno5sXxnT 7a/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194659; x=1684786659; 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=dpbCAPlScfT+jNTPd/atO9Xf54wrVnRGpqtbHXxrQgd2fhmFhul9EoUDFWiEmo/0Mi w4VlPE474tsi35tx+lshR8ttRn/sy8vdTIQcixmV+qQrmGWZkGZbTZXRgYGcFpWeAX43 /jTkpXeefLvMAYiFf28w3OtmA4xtN4BtJP8p6+/ErFyj0YwtMXgqEyB+RrTrlv+K2dDb dbVmDLzSgpjsYLTNt+kdpJEPS0eiwlOORiJOAr4qG9psHrWTjAoOTrp1q9YIiJ9Kr2Qg O5JJTFyDweXQT9k7GJfiLE5ebTP1bgInhW3cvWS96uRxup2GVuqyguMN7dp97WOUAucs JGVA== X-Gm-Message-State: AAQBX9fJychhnoHCmCfyBD5MVsRn0i9JmajbQf0k5n8F+DRadbz+UiH+ cgmsX/u5xslHfG0PNnCL3tuOpCg//aA= X-Google-Smtp-Source: AKy350ZCsMGIFM38sD882pS7uT5IMz540VHwcjfUyZOITGW57sZLHTGBJU7PVQ3vBxd4XZJSpKTy6A== X-Received: by 2002:adf:fdcc:0:b0:2fa:14c8:3f22 with SMTP id i12-20020adffdcc000000b002fa14c83f22mr6305488wrs.30.1682194659435; Sat, 22 Apr 2023 13:17:39 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id k36-20020a05600c1ca400b003f1733feb3dsm11521472wms.0.2023.04.22.13.17.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:39 -0700 (PDT) Message-Id: <2d829783f30ad9d9bee116d777f38b3d89ae0e0c.1682194651.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:14 +0000 Subject: [PATCH v2 07/22] 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 , Derrick Stolee , Elijah Newren , Glen Choo , 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 Sat Apr 22 20:17: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: 13221083 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 D0E6DC6FD18 for ; Sat, 22 Apr 2023 20:17:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229956AbjDVUR7 (ORCPT ); Sat, 22 Apr 2023 16:17:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229565AbjDVURq (ORCPT ); Sat, 22 Apr 2023 16:17:46 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1F36211C for ; Sat, 22 Apr 2023 13:17:41 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-2f58125b957so2709782f8f.3 for ; Sat, 22 Apr 2023 13:17:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194660; x=1684786660; 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=lOw9N/NN79YriHkibbnUzq5AqeQE8wWurqpysx51YrRM4mOIYdnk1rtsU8HIphqByr rq25BjY/e++kwizWpEixzC0Un7iJPORscJBGRIgi9zzinxIwgqUxTtIJIGap2kZKCpx9 G4QYL0WvzBdd9ka9VsOvSNpTQFWpic0EjW1Op132MX9t3MpEEyMn6G1UYmm3lSPTmfak tVoXqQtx5Fyz7TzyhC2QptSd7l6b8vYgBW+djg14mPSp/FktHbnMZEDjfmhbri0xDx2X 7jRE99uZOjd8Zu744N/luKdk4fTuFltq9IOimmeh/yv0lGQU2ll0j10wdjsulsnR4Cc6 svww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194660; x=1684786660; 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=EpqKgKw7eMXAVaKQ/TJHZd7MRwxD4JI+VvS9Jt6QEN61TF6ANviNy3M/BWC/EuBO6o ndoaE6YjVn0CgsxRWgEmgA9di5zk0AO8m9wBE4sr6hjFWEHTpMunFPd0Ksd0dQG3IU4g BEl4BoZJv2O/Q2kXCwC42wA2ldGATpOURdxh1HyMGVWlcmjmQUviPF0YTzJcBQRONgXE GswJfdcrC9uTiuGr0OdcN+ZRd4CBLAw4nVK2F0paHAHTYK08kysIP09O0l0QXX/wWXhg 4TPKnzDqwe+YIZwx579YsPXnBVpJZat5OrXARCS0JQPT3hc7B5+if50DJnkKURpFWTCx j72w== X-Gm-Message-State: AAQBX9djfMurt3uedFW3gqHbbjrt6cqQyREKdIIPEggTHw3gNJdqZ4QW jBJTth2Y8QUwuzg0H1a3Z0R1K0h+qQ8= X-Google-Smtp-Source: AKy350Y52Dw/v+fbs/u2GnH1/VBTS90DX2g+G72DKRmO51Hlfpbl8dKXcI+YbP0Yo+gpzbjYNJyoQw== X-Received: by 2002:adf:ffcf:0:b0:301:8551:446a with SMTP id x15-20020adfffcf000000b003018551446amr6856702wrs.2.1682194659993; Sat, 22 Apr 2023 13:17:39 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id j3-20020a5d6183000000b002faaa9a1721sm7194671wru.58.2023.04.22.13.17.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:39 -0700 (PDT) Message-Id: <0a321c41c3f16ef32a7377263eb1c69a9ae0a819.1682194651.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:15 +0000 Subject: [PATCH v2 08/22] 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 , Derrick Stolee , Elijah Newren , Glen Choo , 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 Sat Apr 22 20:17: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: 13221086 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 CFE11C7618E for ; Sat, 22 Apr 2023 20:18:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229945AbjDVUSC (ORCPT ); Sat, 22 Apr 2023 16:18:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229868AbjDVURr (ORCPT ); Sat, 22 Apr 2023 16:17:47 -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 7C6C82129 for ; Sat, 22 Apr 2023 13:17:42 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3f1957e80a2so39814605e9.1 for ; Sat, 22 Apr 2023 13:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194661; x=1684786661; 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=ktqrgIdSDXYhyvUCH8A9K7jvt/Y/6wSJzi4aQZB1krXQ8z5FpGmlx7SoqK4+t2yguq gvYEIpbHU6HUExXk/BlIZ2IgVE3K3spDk0rQKf8iLLeh5QtOqBn8AnOL3zvhes6nGTy/ Y21uQ11anqMLegOXDkZ+KjoZxJGfErRosfMHdbcWeom4cVHMj2A0/pKsDsBbwughUhOL 8SE8DxHQWmxkVF7YG4uJh4fLdqOiG6JLLXMfsEtX5x8wXqMsCCGyYJbjZKc338fr281T I/1jBUOMMP5ktw2f4Ig36wbAoJLY8lvreduBJGJYxYUeWt07YZLPeQ1K9gzkbP6YlSZT OMPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194661; x=1684786661; 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=KM767Wkvf/M/RoJE99mnSapr28XSxwCnndRvvOjlo/6PhZTDaVsdmZHO6sF3x6HBIh 73UOUBnnqEk1avUA+0gsFiKzO9C+ODm8mL2H79yoIXmfb0LJvNU6BDmOsZlp1df/4QBR Y0s3RhSAS78ch7KkD0KQFon6s3P4u9Nmjxqc1iDoYqtaaZuqJOxB/Y/4uQ3CNDASQAwz 38g3cmtaUDFYYt3iusqxt2Am9JqVe+N3WNqN8MY/Pv83QdT4gbcbg6ePuNLLNzdB8veD 4zQg22t+p5rJ3ql4rEueZjEW0xh2LdL58tyTs0aDtpGsdDWwyP1KvE7Q9ZB4rpp1jxju aHiQ== X-Gm-Message-State: AAQBX9dnulkE5OBW/DTuaQAtyCCokth70U0WtSgHjdQJlD41qFN3KRuf PnTzaA/R2pZnYI4zTrcb8eOOhZDHHYk= X-Google-Smtp-Source: AKy350b329oI4iEmqkoVFFN0P656b/QGavU1SZb+HsiAF3XIT5oX6etflY1Fbh4CPPZdV6uKcviAHQ== X-Received: by 2002:adf:e689:0:b0:2f9:805f:eecb with SMTP id r9-20020adfe689000000b002f9805feecbmr6644074wrm.3.1682194660727; Sat, 22 Apr 2023 13:17:40 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id k6-20020a5d5246000000b002fe87e0706bsm7179578wrc.97.2023.04.22.13.17.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:40 -0700 (PDT) Message-Id: <951eff98a4d3f7cc4190dcd080b0648f62b84cf1.1682194651.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:16 +0000 Subject: [PATCH v2 09/22] 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 , Derrick Stolee , Elijah Newren , Glen Choo , 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 Sat Apr 22 20:17: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: 13221087 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 94A3FC6FD18 for ; Sat, 22 Apr 2023 20:18:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229533AbjDVUSD (ORCPT ); Sat, 22 Apr 2023 16:18:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229882AbjDVURr (ORCPT ); Sat, 22 Apr 2023 16:17:47 -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 1158E2122 for ; Sat, 22 Apr 2023 13:17:43 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3f19b9d5358so5220535e9.1 for ; Sat, 22 Apr 2023 13:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194661; x=1684786661; 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=hSCcXpZ+7CnrDJchQTqnageWgcE86ipYwpaJVNE+Sgqhuwribuaqq8QPtrscVQvEl5 iFEil/19X/JwRYzpE661mwkZx8ETYsZkNdquNLKCGJyNvkZdFg/ygcNL7rv34hsQ61WE 74a3TKAoh3PAjlQ/m42hvgafgcNws77Dgz2kYxRX3S8smM7WQfbMnABzsHvjyOvA7S3u A+t7Go0GlRwK7I7OO7R6G8Rwh/0No+xEXNiie8tJ89YtQB7Oy6VAU1hxOo9uNDqxBkXN 57PoVP814auuDi8JcChB//z67j1Kizfja3L541NegZjwDda6JjAs9LOxOGpeqgvPTKXN piJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194661; x=1684786661; 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=IAA3pBwQwcAm4FlkJFS1ce4P2XI8RjuakWCTQtXxIMwFaiP7cD3P1qH2vmxPyEOWW+ M6LdEZvrGa6Bl95kzgI5u6CAEBpm9MM/4K9A8Zz3RyUhI+XZzc0Zq/w2tuiocreABeUq BUr+1mAMuATHOmhX61Fie/POJTxmDXzYCzTTL1SMr6BIJdsXXq2HsC03mg0sra9wxbXd 2vRPrlZsDd7KoKkAH0PM64BfSW3ajNaRn2OUUdXuuGdvOJLP7ro54Q1uhw+Xx1+/eaof BVxnc0Ha1FUv3mQch6GPg+8hktsRsvibWyQGnp4Z71f9qUAQtVw7SgVB5Tx5N1HonldL /xIQ== X-Gm-Message-State: AAQBX9e5FOX42qn8b0YBKmi28DI7fe03ZWWvWqTE69b/hEcI+mGB8HV6 HTN9VimQeGUcpVc3Ew2zs4ZuVfyb2kU= X-Google-Smtp-Source: AKy350YhoVX+I8uoThn+Cs8Vs5FZ6dVr4lQriAMrZrABoz5VVJ5yt4M4fl6XjhmT9oxQ40Xdi0Ok4g== X-Received: by 2002:a05:600c:b5a:b0:3f1:979f:a734 with SMTP id k26-20020a05600c0b5a00b003f1979fa734mr2190670wmr.11.1682194661460; Sat, 22 Apr 2023 13:17:41 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id u15-20020a05600c210f00b003f17848673fsm8001537wml.27.2023.04.22.13.17.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:41 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:17 +0000 Subject: [PATCH v2 10/22] 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 , Derrick Stolee , Elijah Newren , Glen Choo , 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 Sat Apr 22 20:17: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: 13221088 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 88F77C7618E for ; Sat, 22 Apr 2023 20:18:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229980AbjDVUSG (ORCPT ); Sat, 22 Apr 2023 16:18:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229894AbjDVURs (ORCPT ); Sat, 22 Apr 2023 16:17:48 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A9142699 for ; Sat, 22 Apr 2023 13:17:43 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-2f3fe12de15so1778043f8f.3 for ; Sat, 22 Apr 2023 13:17:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194662; x=1684786662; 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=mUi3EzOrk1+SptgQPjxkCInc24I8+3omfwtM8jDFyaJ2Y7+IEC/AAXU8H06ZZ2Z7e+ 0kIYnOur3HB4Hf2xgov+nKBkhXJsv3NPAS9/YtRqVjBmLJxCQI1wasYnkknxh096MbAe iJg8Op9uNfGxIcSxTQ+f/RmD5jSYHYMmpPFrtiV/9RhvHQ8AL1csA5oLmQ9uNggn80UJ ISg4l1GeG+CAXEN0FofKdo7DNbuM8uTvKLjKbtmYs/06IUn787Di3hSifAG+qn76HIqH rkL4yWbGoaEWVKph79LyZe0MhqfJ4c+V1CRmgSKmx/bZBOw6+NJGrXS9UI6e/CS54Czc T0JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194662; x=1684786662; 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=XZ8VyCEvqZ3y/ia1EBjdRbitBiVXg4CWPZZ45Pj08JK8uGCXDVZzPfI1sr4RhnPEok qMt82n+74MIU4L7S0/T7OtrRBKnDIWpP9Qk9AodJkDQCt1FsnrQ+4m6TN2kCtaVOhx3T saqLYqu3O0naCh1NsD+uTJTlgIVC9IaLCgqFyzslqXGTBV+EncHe0UfBcp2vsuJdPpc0 a8KIGyjxznhIrFPmBifi8ht092JXG4znLO6OXpN5KvkmSGJx+oNS/u34jH5MD8FF7iBK FrS29QGU6V7iPo41lU2LsoKPQhNDizw0QhDUvHv8Y0ZaU0vL1sZSlY5RBOgMJp4hKBwx +erw== X-Gm-Message-State: AAQBX9e4xbRatP3hZK4r2TLHXBxuYrrZEwLLeWKW2tLS+fphnbl0wpLE vXTRgpzyGaQTYMo6zPG5Kr+I3ImLVJc= X-Google-Smtp-Source: AKy350YgtRW7XOHttdHU8yLK6DZb91jVaAdhkz+5FydSKlIFoV/u8ax0yFhqFBYlTc1c3uoMqEWFsw== X-Received: by 2002:a5d:6407:0:b0:2fe:fde1:23a2 with SMTP id z7-20020a5d6407000000b002fefde123a2mr7348360wru.50.1682194662144; Sat, 22 Apr 2023 13:17:42 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id d13-20020adfe88d000000b002e55cc69169sm7206269wrm.38.2023.04.22.13.17.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:41 -0700 (PDT) Message-Id: <673a3ae4fe2cc9a341e33dde6bd756e517f6f658.1682194651.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:18 +0000 Subject: [PATCH v2 11/22] dir.h: move DTYPE defines from cache.h Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Derrick Stolee , Elijah Newren , Glen Choo , 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 Sat Apr 22 20:17: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: 13221091 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 27F5EC7618E for ; Sat, 22 Apr 2023 20:18:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229986AbjDVUSM (ORCPT ); Sat, 22 Apr 2023 16:18:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229864AbjDVURs (ORCPT ); Sat, 22 Apr 2023 16:17:48 -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 7BD512116 for ; Sat, 22 Apr 2023 13:17:44 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3f18123d9f6so19461065e9.0 for ; Sat, 22 Apr 2023 13:17:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194662; x=1684786662; 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=XxzsCayQNVfBvlf/mzHlSFNBprIf1FMeu/4oUxYQ7N8DdinkDNdRqHIQ3eBomUmupc O4wWLwkPZamvZt/riNxOM97qHusDiEzk4KGpgDtvAzZOD9Y1M/irwYgxoRbj63VifgGt YtqRodBO1Gdn0K3PNRLli/q/+Y+QRaj+xW70qrqY78aWNgujHcwl8g8xUgat99Ett16o nZKXWGWk176bGU9bao2xwZ5E4EaCOtcUEkxlnSFwNQw3ldd+vMuh9dlxC+NtwCLUByS0 xTanDaPad7uVq+Wkp4v9M6143mcNrPjggbWfWKErF+0+kHQFfdzYGiQ1caKpzAEKcIYL K2xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194662; x=1684786662; 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=idcVjfWQmTQq5bAGcIW4xTi2N85Td5gy0xTarzw/NJe1H9r7muDk3JLeo5ovmhJIKw zqq/8qQYK3VjzrhexvMtKwYzbc+B9zplhYsAe7kmR20MgGwS0YnsdarLzak4OU4cABXL g+ZvQqCHt32yQd7W8OttkBG7azK7e+znaCVWGMejpFmlWcP1ouz2wgHqUVqdTQbu1Owt CKpnJASpTFGn1eh5jl3B9zwc3e0gkpQkKTg0GCYbeK+F2En0shv9p6y3v+9DSk+ZF4kU kCzlVXvMDzMSTJ4DbNXHnRsFmFUB4NH+UEKu2o3jJoBJc+hQResknbnLRNgI8vj9cIfl 3fMg== X-Gm-Message-State: AAQBX9fsd4yLpma8feIks7ik9SRtTszI4S+J8jBxnaqbr3qLIi+9bAIY fpCWjY7u3aRc9KSze/0qXzlfUF4/e7c= X-Google-Smtp-Source: AKy350blWkF5j+hAMEvSRtt3IkxkWevIlJlRaCiq0gphLvTdP3SRDoUdbplwGqvBm4RYajU/p1GroQ== X-Received: by 2002:a05:600c:21a:b0:3f1:75b6:8c7 with SMTP id 26-20020a05600c021a00b003f175b608c7mr4485201wmi.37.1682194662794; Sat, 22 Apr 2023 13:17:42 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id k24-20020a7bc318000000b003f16fc33fbesm8051430wmj.17.2023.04.22.13.17.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:42 -0700 (PDT) Message-Id: <7b55f82e62ecf761b804432c8d08dffabbb7605f.1682194651.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:19 +0000 Subject: [PATCH v2 12/22] 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 , Derrick Stolee , Elijah Newren , Glen Choo , 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 Sat Apr 22 20:17: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: 13221096 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 63F98C7618E for ; Sat, 22 Apr 2023 20:18:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229911AbjDVUSY (ORCPT ); Sat, 22 Apr 2023 16:18:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229920AbjDVURx (ORCPT ); Sat, 22 Apr 2023 16:17:53 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1378F26B3 for ; Sat, 22 Apr 2023 13:17:46 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3f19a7f9424so7030815e9.2 for ; Sat, 22 Apr 2023 13:17:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194664; x=1684786664; 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=popZ6xrYqZgSo+EsmD+9fjLRrrNLD3ldxdFcUo2c4Cw=; b=NAewMaxWZ1WdkAqWZhhRTIn4ErZETAtzYa0urQpMe3g0zL/8OobuftkymmwFzZbOD6 ED17rM3laGRBy6ekAvjvDjlvTiwXZ7qbNuj/4JLjZ4RY0SX7LAEqOweXyiPyGNbxW+Og oRp2XOVfLaq6B9LQmrQaDODRtrqbhuFV2E498gxZJ+9GPyz8xIKo346sDPeG09FPoiee RO2I1uNYB80tls9ivewS6rqwNs6v0eKC1rYmlKVLk9xxbIQ1aybRqw6uLbwASPpPEppn 4n8OVK0/pA3ENOWJtTQ5eI8Lu6qjA+e4jHyZB5s53vUhlbLxHyL05VwB6uQo+P2wLaTq Xq2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194664; x=1684786664; 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=popZ6xrYqZgSo+EsmD+9fjLRrrNLD3ldxdFcUo2c4Cw=; b=TZYNwOrpPZNpjd4m4YJT4ropBoiNAIuiYfStrxD2HvEWgpr1W/ieUWM3HtY1MQUP5u 0xHMPvxEiI717yBmAetEnVJVlsL5sKPxyahwfVdxPNlW3qwtmXezC5Vy0uz4hrhrYkhl vN74g07kwMQgAdzYpTlIKTXLSzip3uiyQOD+is3BFuSdt5TpFAxF+u0zwhhVU6IqjhXr izuewzjiUKvV+ccKYBuhRCmCq4bYeh+qiSmyXHDE2gcT4zXBmEsUtBGgqPY/UVUHH4XA qiCZamyH+JG4J9xZ8LuJ4TwbKn8fN+UvNM6h4clShHBNGJkEUllY0fDVmGuLWz92kQq7 oy2g== X-Gm-Message-State: AAQBX9dUKRbSgzlu3UCzodvl3iL71JfHRpIubJV6AC+uLQVx/N/GIRDs fxVvzsrHTssGRU+o9kK0wWhovStwnuM= X-Google-Smtp-Source: AKy350aziLa8KJpn47jNQ2yCVlVJbFrEv7W9MGhOtoRHEKDERhi1MnnjnioMlM8IyWq5CZ2dWK7o7Q== X-Received: by 2002:a5d:6342:0:b0:2e6:3804:5be with SMTP id b2-20020a5d6342000000b002e6380405bemr6398164wrw.59.1682194663476; Sat, 22 Apr 2023 13:17:43 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id p6-20020adfe606000000b002ff1751ec79sm7185207wrm.65.2023.04.22.13.17.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:43 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:20 +0000 Subject: [PATCH v2 13/22] hash-ll.h: split out of hash.h to remove dependency on repository.h Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Derrick Stolee , Elijah Newren , Glen Choo , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren hash.h depends upon and includes repository.h, due to the definition and use of the_hash_algo (defined as the_repository->hash_algo). However, most headers trying to include hash.h are only interested in the layout of the structs like object_id. Move the parts of hash.h that do not depend upon repository.h into a new file hash-ll.h (the "low level" parts of hash.h), and adjust other files to use this new header where the convenience inline functions aren't needed. 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), so also adjust other files to be more explicit about what they depend upon. Signed-off-by: Elijah Newren --- alloc.c | 1 + apply.h | 2 +- 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 | 2 + builtin/mv.c | 1 + builtin/push.c | 1 + builtin/read-tree.c | 1 + builtin/rerere.c | 1 + builtin/rm.c | 2 + builtin/show-branch.c | 2 + builtin/show-index.c | 2 + builtin/update-index.c | 2 + builtin/update-ref.c | 2 + builtin/upload-archive.c | 1 + builtin/worktree.c | 1 + checkout.c | 1 + checkout.h | 2 +- chunk-format.c | 1 + chunk-format.h | 2 +- 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 + convert.h | 2 +- copy.c | 1 + csum-file.c | 1 + csum-file.h | 2 +- daemon.c | 1 + diffcore.h | 2 +- editor.c | 1 + exec-cmd.c | 1 + fsmonitor-ipc.c | 1 + gpg-interface.c | 1 + hash-ll.h | 276 +++++++++++++++++++ hash-lookup.c | 1 + hash.h | 273 +----------------- hashmap.h | 2 +- hex.c | 1 + hex.h | 2 +- hook.c | 1 + khash.h | 1 + ls-refs.c | 1 + merge-ort-wrappers.c | 1 + merge-ort.h | 2 +- negotiator/default.c | 1 + negotiator/skipping.c | 1 + object-file.h | 2 + object.h | 3 +- oidmap.c | 1 + oidtree.h | 2 +- parallel-checkout.c | 1 + pathspec.c | 1 + progress.c | 1 + protocol-caps.c | 2 +- rebase-interactive.c | 1 + refs/files-backend.c | 1 + refs/packed-backend.c | 1 + refs/ref-cache.c | 2 + refs/ref-cache.h | 3 +- refspec.c | 1 + reftable/dump.c | 2 +- reftable/system.h | 2 +- reset.h | 2 +- resolve-undo.c | 1 + resolve-undo.h | 2 +- split-index.c | 1 + split-index.h | 2 +- strbuf.c | 1 + t/helper/test-bloom.c | 1 + t/helper/test-cache-tree.c | 1 + t/helper/test-dump-cache-tree.c | 2 + 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 | 2 + 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 | 3 +- tree.h | 1 + wrapper.c | 1 + xdiff-interface.h | 2 +- 109 files changed, 398 insertions(+), 292 deletions(-) create mode 100644 hash-ll.h 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/apply.h b/apply.h index b9f18ce87d1..7cd38b1443c 100644 --- a/apply.h +++ b/apply.h @@ -1,7 +1,7 @@ #ifndef APPLY_H #define APPLY_H -#include "hash.h" +#include "hash-ll.h" #include "lockfile.h" #include "string-list.h" #include "strmap.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..ff2fe8ef125 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -9,6 +9,7 @@ #include "ident.h" #include "parse-options.h" #include "urlmatch.h" +#include "path.h" #include "quote.h" #include "setup.h" #include "worktree.h" diff --git a/builtin/credential-cache.c b/builtin/credential-cache.c index 508da4c6e4d..0ffacfdd83c 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 "path.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..90da9d07744 100644 --- a/builtin/merge-recursive.c +++ b/builtin/merge-recursive.c @@ -3,9 +3,11 @@ #include "advice.h" #include "commit.h" #include "gettext.h" +#include "hash.h" #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..b4589c824c0 100644 --- a/builtin/rm.c +++ b/builtin/rm.c @@ -12,9 +12,11 @@ #include "dir.h" #include "cache-tree.h" #include "gettext.h" +#include "hash.h" #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..7ef4a642c17 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -2,6 +2,7 @@ #include "config.h" #include "environment.h" #include "gettext.h" +#include "hash.h" #include "hex.h" #include "pretty.h" #include "refs.h" @@ -10,6 +11,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..d839e55335d 100644 --- a/builtin/show-index.c +++ b/builtin/show-index.c @@ -1,9 +1,11 @@ #include "builtin.h" #include "cache.h" #include "gettext.h" +#include "hash.h" #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..5fab9ad2ec4 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -9,6 +9,7 @@ #include "config.h" #include "environment.h" #include "gettext.h" +#include "hash.h" #include "hex.h" #include "lockfile.h" #include "quote.h" @@ -21,6 +22,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..0c59b1c9eff 100644 --- a/builtin/update-ref.c +++ b/builtin/update-ref.c @@ -1,11 +1,13 @@ #include "cache.h" #include "config.h" #include "gettext.h" +#include "hash.h" #include "refs.h" #include "builtin.h" #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/checkout.h b/checkout.h index 1917f3b3230..3c514a5ab4f 100644 --- a/checkout.h +++ b/checkout.h @@ -1,7 +1,7 @@ #ifndef CHECKOUT_H #define CHECKOUT_H -#include "hash.h" +#include "hash-ll.h" /* * Check if the branch name uniquely matches a branch name on a remote diff --git a/chunk-format.c b/chunk-format.c index 60a73c1b140..e7d613c907e 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 "hash.h" #include "trace2.h" /* diff --git a/chunk-format.h b/chunk-format.h index 025c38f938e..c7794e84add 100644 --- a/chunk-format.h +++ b/chunk-format.h @@ -1,7 +1,7 @@ #ifndef CHUNK_FORMAT_H #define CHUNK_FORMAT_H -#include "hash.h" +#include "hash-ll.h" struct hashfile; struct chunkfile; 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/convert.h b/convert.h index 0a6e4086b8f..d925589444b 100644 --- a/convert.h +++ b/convert.h @@ -4,7 +4,7 @@ #ifndef CONVERT_H #define CONVERT_H -#include "hash.h" +#include "hash-ll.h" #include "string-list.h" struct index_state; 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..daf9b06dfff 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 "hash.h" #include "wrapper.h" static void verify_buffer_or_die(struct hashfile *f, diff --git a/csum-file.h b/csum-file.h index 566e05cbd25..bc5bec27acb 100644 --- a/csum-file.h +++ b/csum-file.h @@ -1,7 +1,7 @@ #ifndef CSUM_FILE_H #define CSUM_FILE_H -#include "hash.h" +#include "hash-ll.h" #include "write-or-die.h" struct progress; 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/diffcore.h b/diffcore.h index 1701ed50b9c..5ffe4ec788f 100644 --- a/diffcore.h +++ b/diffcore.h @@ -4,7 +4,7 @@ #ifndef DIFFCORE_H #define DIFFCORE_H -#include "hash.h" +#include "hash-ll.h" struct diff_options; struct mem_pool; 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-ll.h b/hash-ll.h new file mode 100644 index 00000000000..80509251370 --- /dev/null +++ b/hash-ll.h @@ -0,0 +1,276 @@ +#ifndef HASH_LL_H +#define HASH_LL_H + +#if defined(SHA1_APPLE) +#include +#elif defined(SHA1_OPENSSL) +#include +#elif defined(SHA1_DC) +#include "sha1dc_git.h" +#else /* SHA1_BLK */ +#include "block-sha1/sha1.h" +#endif + +#if defined(SHA256_NETTLE) +#include "sha256/nettle.h" +#elif defined(SHA256_GCRYPT) +#define SHA256_NEEDS_CLONE_HELPER +#include "sha256/gcrypt.h" +#elif defined(SHA256_OPENSSL) +#include +#else +#include "sha256/block/sha256.h" +#endif + +#ifndef platform_SHA_CTX +/* + * platform's underlying implementation of SHA-1; could be OpenSSL, + * blk_SHA, Apple CommonCrypto, etc... Note that the relevant + * SHA-1 header may have already defined platform_SHA_CTX for our + * own implementations like block-sha1, so we list + * the default for OpenSSL compatible SHA-1 implementations here. + */ +#define platform_SHA_CTX SHA_CTX +#define platform_SHA1_Init SHA1_Init +#define platform_SHA1_Update SHA1_Update +#define platform_SHA1_Final SHA1_Final +#endif + +#define git_SHA_CTX platform_SHA_CTX +#define git_SHA1_Init platform_SHA1_Init +#define git_SHA1_Update platform_SHA1_Update +#define git_SHA1_Final platform_SHA1_Final + +#ifndef platform_SHA256_CTX +#define platform_SHA256_CTX SHA256_CTX +#define platform_SHA256_Init SHA256_Init +#define platform_SHA256_Update SHA256_Update +#define platform_SHA256_Final SHA256_Final +#endif + +#define git_SHA256_CTX platform_SHA256_CTX +#define git_SHA256_Init platform_SHA256_Init +#define git_SHA256_Update platform_SHA256_Update +#define git_SHA256_Final platform_SHA256_Final + +#ifdef platform_SHA256_Clone +#define git_SHA256_Clone platform_SHA256_Clone +#endif + +#ifdef SHA1_MAX_BLOCK_SIZE +#include "compat/sha1-chunked.h" +#undef git_SHA1_Update +#define git_SHA1_Update git_SHA1_Update_Chunked +#endif + +static inline void git_SHA1_Clone(git_SHA_CTX *dst, const git_SHA_CTX *src) +{ + memcpy(dst, src, sizeof(*dst)); +} + +#ifndef SHA256_NEEDS_CLONE_HELPER +static inline void git_SHA256_Clone(git_SHA256_CTX *dst, const git_SHA256_CTX *src) +{ + memcpy(dst, src, sizeof(*dst)); +} +#endif + +/* + * Note that these constants are suitable for indexing the hash_algos array and + * comparing against each other, but are otherwise arbitrary, so they should not + * be exposed to the user or serialized to disk. To know whether a + * git_hash_algo struct points to some usable hash function, test the format_id + * field for being non-zero. Use the name field for user-visible situations and + * the format_id field for fixed-length fields on disk. + */ +/* An unknown hash function. */ +#define GIT_HASH_UNKNOWN 0 +/* SHA-1 */ +#define GIT_HASH_SHA1 1 +/* SHA-256 */ +#define GIT_HASH_SHA256 2 +/* Number of algorithms supported (including unknown). */ +#define GIT_HASH_NALGOS (GIT_HASH_SHA256 + 1) + +/* "sha1", big-endian */ +#define GIT_SHA1_FORMAT_ID 0x73686131 + +/* The length in bytes and in hex digits of an object name (SHA-1 value). */ +#define GIT_SHA1_RAWSZ 20 +#define GIT_SHA1_HEXSZ (2 * GIT_SHA1_RAWSZ) +/* The block size of SHA-1. */ +#define GIT_SHA1_BLKSZ 64 + +/* "s256", big-endian */ +#define GIT_SHA256_FORMAT_ID 0x73323536 + +/* The length in bytes and in hex digits of an object name (SHA-256 value). */ +#define GIT_SHA256_RAWSZ 32 +#define GIT_SHA256_HEXSZ (2 * GIT_SHA256_RAWSZ) +/* The block size of SHA-256. */ +#define GIT_SHA256_BLKSZ 64 + +/* The length in byte and in hex digits of the largest possible hash value. */ +#define GIT_MAX_RAWSZ GIT_SHA256_RAWSZ +#define GIT_MAX_HEXSZ GIT_SHA256_HEXSZ +/* The largest possible block size for any supported hash. */ +#define GIT_MAX_BLKSZ GIT_SHA256_BLKSZ + +struct object_id { + unsigned char hash[GIT_MAX_RAWSZ]; + int algo; /* XXX requires 4-byte alignment */ +}; + +#define GET_OID_QUIETLY 01 +#define GET_OID_COMMIT 02 +#define GET_OID_COMMITTISH 04 +#define GET_OID_TREE 010 +#define GET_OID_TREEISH 020 +#define GET_OID_BLOB 040 +#define GET_OID_FOLLOW_SYMLINKS 0100 +#define GET_OID_RECORD_PATH 0200 +#define GET_OID_ONLY_TO_DIE 04000 +#define GET_OID_REQUIRE_PATH 010000 + +#define GET_OID_DISAMBIGUATORS \ + (GET_OID_COMMIT | GET_OID_COMMITTISH | \ + GET_OID_TREE | GET_OID_TREEISH | \ + GET_OID_BLOB) + +enum get_oid_result { + FOUND = 0, + MISSING_OBJECT = -1, /* The requested object is missing */ + SHORT_NAME_AMBIGUOUS = -2, + /* The following only apply when symlinks are followed */ + DANGLING_SYMLINK = -4, /* + * The initial symlink is there, but + * (transitively) points to a missing + * in-tree file + */ + SYMLINK_LOOP = -5, + NOT_DIR = -6, /* + * Somewhere along the symlink chain, a path is + * requested which contains a file as a + * non-final element. + */ +}; + +/* A suitably aligned type for stack allocations of hash contexts. */ +union git_hash_ctx { + git_SHA_CTX sha1; + git_SHA256_CTX sha256; +}; +typedef union git_hash_ctx git_hash_ctx; + +typedef void (*git_hash_init_fn)(git_hash_ctx *ctx); +typedef void (*git_hash_clone_fn)(git_hash_ctx *dst, const git_hash_ctx *src); +typedef void (*git_hash_update_fn)(git_hash_ctx *ctx, const void *in, size_t len); +typedef void (*git_hash_final_fn)(unsigned char *hash, git_hash_ctx *ctx); +typedef void (*git_hash_final_oid_fn)(struct object_id *oid, git_hash_ctx *ctx); + +struct git_hash_algo { + /* + * The name of the algorithm, as appears in the config file and in + * messages. + */ + const char *name; + + /* A four-byte version identifier, used in pack indices. */ + uint32_t format_id; + + /* The length of the hash in binary. */ + size_t rawsz; + + /* The length of the hash in hex characters. */ + size_t hexsz; + + /* The block size of the hash. */ + size_t blksz; + + /* The hash initialization function. */ + git_hash_init_fn init_fn; + + /* The hash context cloning function. */ + git_hash_clone_fn clone_fn; + + /* The hash update function. */ + git_hash_update_fn update_fn; + + /* The hash finalization function. */ + git_hash_final_fn final_fn; + + /* The hash finalization function for object IDs. */ + git_hash_final_oid_fn final_oid_fn; + + /* The OID of the empty tree. */ + const struct object_id *empty_tree; + + /* The OID of the empty blob. */ + const struct object_id *empty_blob; + + /* The all-zeros OID. */ + const struct object_id *null_oid; +}; +extern const struct git_hash_algo hash_algos[GIT_HASH_NALGOS]; + +/* + * Return a GIT_HASH_* constant based on the name. Returns GIT_HASH_UNKNOWN if + * the name doesn't match a known algorithm. + */ +int hash_algo_by_name(const char *name); +/* Identical, except based on the format ID. */ +int hash_algo_by_id(uint32_t format_id); +/* Identical, except based on the length. */ +int hash_algo_by_length(int len); +/* Identical, except for a pointer to struct git_hash_algo. */ +static inline int hash_algo_by_ptr(const struct git_hash_algo *p) +{ + return p - hash_algos; +} + +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) +{ + /* + * Teach the compiler that there are only two possibilities of hash size + * here, so that it can optimize for this case as much as possible. + */ + if (algop->rawsz == GIT_MAX_RAWSZ) + return memcmp(sha1, sha2, GIT_MAX_RAWSZ); + return memcmp(sha1, sha2, GIT_SHA1_RAWSZ); +} + +static inline int hasheq_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop) +{ + /* + * We write this here instead of deferring to hashcmp so that the + * compiler can properly inline it and avoid calling memcmp. + */ + if (algop->rawsz == GIT_MAX_RAWSZ) + return !memcmp(sha1, sha2, GIT_MAX_RAWSZ); + return !memcmp(sha1, sha2, GIT_SHA1_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; +} + +static inline struct object_id *oiddup(const struct object_id *src) +{ + struct object_id *dst = xmalloc(sizeof(struct object_id)); + oidcpy(dst, src); + return dst; +} + +static inline void oid_set_algo(struct object_id *oid, const struct git_hash_algo *algop) +{ + oid->algo = hash_algo_by_ptr(algop); +} + +const char *empty_tree_oid_hex(void); +const char *empty_blob_oid_hex(void); + +#endif diff --git a/hash-lookup.c b/hash-lookup.c index b98ed5e11e8..bb54dfde9c7 100644 --- a/hash-lookup.c +++ b/hash-lookup.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "hash.h" #include "hash-lookup.h" static uint32_t take2(const struct object_id *oid, size_t ofs) diff --git a/hash.h b/hash.h index d39f73618cb..615ae0691d0 100644 --- a/hash.h +++ b/hash.h @@ -1,250 +1,11 @@ #ifndef HASH_H #define HASH_H +#include "hash-ll.h" #include "repository.h" -#if defined(SHA1_APPLE) -#include -#elif defined(SHA1_OPENSSL) -#include -#elif defined(SHA1_DC) -#include "sha1dc_git.h" -#else /* SHA1_BLK */ -#include "block-sha1/sha1.h" -#endif - -#if defined(SHA256_NETTLE) -#include "sha256/nettle.h" -#elif defined(SHA256_GCRYPT) -#define SHA256_NEEDS_CLONE_HELPER -#include "sha256/gcrypt.h" -#elif defined(SHA256_OPENSSL) -#include -#else -#include "sha256/block/sha256.h" -#endif - -#ifndef platform_SHA_CTX -/* - * platform's underlying implementation of SHA-1; could be OpenSSL, - * blk_SHA, Apple CommonCrypto, etc... Note that the relevant - * SHA-1 header may have already defined platform_SHA_CTX for our - * own implementations like block-sha1, so we list - * the default for OpenSSL compatible SHA-1 implementations here. - */ -#define platform_SHA_CTX SHA_CTX -#define platform_SHA1_Init SHA1_Init -#define platform_SHA1_Update SHA1_Update -#define platform_SHA1_Final SHA1_Final -#endif - -#define git_SHA_CTX platform_SHA_CTX -#define git_SHA1_Init platform_SHA1_Init -#define git_SHA1_Update platform_SHA1_Update -#define git_SHA1_Final platform_SHA1_Final - -#ifndef platform_SHA256_CTX -#define platform_SHA256_CTX SHA256_CTX -#define platform_SHA256_Init SHA256_Init -#define platform_SHA256_Update SHA256_Update -#define platform_SHA256_Final SHA256_Final -#endif - -#define git_SHA256_CTX platform_SHA256_CTX -#define git_SHA256_Init platform_SHA256_Init -#define git_SHA256_Update platform_SHA256_Update -#define git_SHA256_Final platform_SHA256_Final - -#ifdef platform_SHA256_Clone -#define git_SHA256_Clone platform_SHA256_Clone -#endif - -#ifdef SHA1_MAX_BLOCK_SIZE -#include "compat/sha1-chunked.h" -#undef git_SHA1_Update -#define git_SHA1_Update git_SHA1_Update_Chunked -#endif - -static inline void git_SHA1_Clone(git_SHA_CTX *dst, const git_SHA_CTX *src) -{ - memcpy(dst, src, sizeof(*dst)); -} - -#ifndef SHA256_NEEDS_CLONE_HELPER -static inline void git_SHA256_Clone(git_SHA256_CTX *dst, const git_SHA256_CTX *src) -{ - memcpy(dst, src, sizeof(*dst)); -} -#endif - -/* - * Note that these constants are suitable for indexing the hash_algos array and - * comparing against each other, but are otherwise arbitrary, so they should not - * be exposed to the user or serialized to disk. To know whether a - * git_hash_algo struct points to some usable hash function, test the format_id - * field for being non-zero. Use the name field for user-visible situations and - * the format_id field for fixed-length fields on disk. - */ -/* An unknown hash function. */ -#define GIT_HASH_UNKNOWN 0 -/* SHA-1 */ -#define GIT_HASH_SHA1 1 -/* SHA-256 */ -#define GIT_HASH_SHA256 2 -/* Number of algorithms supported (including unknown). */ -#define GIT_HASH_NALGOS (GIT_HASH_SHA256 + 1) - -/* "sha1", big-endian */ -#define GIT_SHA1_FORMAT_ID 0x73686131 - -/* The length in bytes and in hex digits of an object name (SHA-1 value). */ -#define GIT_SHA1_RAWSZ 20 -#define GIT_SHA1_HEXSZ (2 * GIT_SHA1_RAWSZ) -/* The block size of SHA-1. */ -#define GIT_SHA1_BLKSZ 64 - -/* "s256", big-endian */ -#define GIT_SHA256_FORMAT_ID 0x73323536 - -/* The length in bytes and in hex digits of an object name (SHA-256 value). */ -#define GIT_SHA256_RAWSZ 32 -#define GIT_SHA256_HEXSZ (2 * GIT_SHA256_RAWSZ) -/* The block size of SHA-256. */ -#define GIT_SHA256_BLKSZ 64 - -/* The length in byte and in hex digits of the largest possible hash value. */ -#define GIT_MAX_RAWSZ GIT_SHA256_RAWSZ -#define GIT_MAX_HEXSZ GIT_SHA256_HEXSZ -/* The largest possible block size for any supported hash. */ -#define GIT_MAX_BLKSZ GIT_SHA256_BLKSZ - -struct object_id { - unsigned char hash[GIT_MAX_RAWSZ]; - int algo; /* XXX requires 4-byte alignment */ -}; - -#define GET_OID_QUIETLY 01 -#define GET_OID_COMMIT 02 -#define GET_OID_COMMITTISH 04 -#define GET_OID_TREE 010 -#define GET_OID_TREEISH 020 -#define GET_OID_BLOB 040 -#define GET_OID_FOLLOW_SYMLINKS 0100 -#define GET_OID_RECORD_PATH 0200 -#define GET_OID_ONLY_TO_DIE 04000 -#define GET_OID_REQUIRE_PATH 010000 - -#define GET_OID_DISAMBIGUATORS \ - (GET_OID_COMMIT | GET_OID_COMMITTISH | \ - GET_OID_TREE | GET_OID_TREEISH | \ - GET_OID_BLOB) - -enum get_oid_result { - FOUND = 0, - MISSING_OBJECT = -1, /* The requested object is missing */ - SHORT_NAME_AMBIGUOUS = -2, - /* The following only apply when symlinks are followed */ - DANGLING_SYMLINK = -4, /* - * The initial symlink is there, but - * (transitively) points to a missing - * in-tree file - */ - SYMLINK_LOOP = -5, - NOT_DIR = -6, /* - * Somewhere along the symlink chain, a path is - * requested which contains a file as a - * non-final element. - */ -}; - -/* A suitably aligned type for stack allocations of hash contexts. */ -union git_hash_ctx { - git_SHA_CTX sha1; - git_SHA256_CTX sha256; -}; -typedef union git_hash_ctx git_hash_ctx; - -typedef void (*git_hash_init_fn)(git_hash_ctx *ctx); -typedef void (*git_hash_clone_fn)(git_hash_ctx *dst, const git_hash_ctx *src); -typedef void (*git_hash_update_fn)(git_hash_ctx *ctx, const void *in, size_t len); -typedef void (*git_hash_final_fn)(unsigned char *hash, git_hash_ctx *ctx); -typedef void (*git_hash_final_oid_fn)(struct object_id *oid, git_hash_ctx *ctx); - -struct git_hash_algo { - /* - * The name of the algorithm, as appears in the config file and in - * messages. - */ - const char *name; - - /* A four-byte version identifier, used in pack indices. */ - uint32_t format_id; - - /* The length of the hash in binary. */ - size_t rawsz; - - /* The length of the hash in hex characters. */ - size_t hexsz; - - /* The block size of the hash. */ - size_t blksz; - - /* The hash initialization function. */ - git_hash_init_fn init_fn; - - /* The hash context cloning function. */ - git_hash_clone_fn clone_fn; - - /* The hash update function. */ - git_hash_update_fn update_fn; - - /* The hash finalization function. */ - git_hash_final_fn final_fn; - - /* The hash finalization function for object IDs. */ - git_hash_final_oid_fn final_oid_fn; - - /* The OID of the empty tree. */ - const struct object_id *empty_tree; - - /* The OID of the empty blob. */ - const struct object_id *empty_blob; - - /* The all-zeros OID. */ - const struct object_id *null_oid; -}; -extern const struct git_hash_algo hash_algos[GIT_HASH_NALGOS]; - -/* - * Return a GIT_HASH_* constant based on the name. Returns GIT_HASH_UNKNOWN if - * the name doesn't match a known algorithm. - */ -int hash_algo_by_name(const char *name); -/* Identical, except based on the format ID. */ -int hash_algo_by_id(uint32_t format_id); -/* Identical, except based on the length. */ -int hash_algo_by_length(int len); -/* Identical, except for a pointer to struct git_hash_algo. */ -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) -{ - /* - * Teach the compiler that there are only two possibilities of hash size - * here, so that it can optimize for this case as much as possible. - */ - if (algop->rawsz == GIT_MAX_RAWSZ) - return memcmp(sha1, sha2, GIT_MAX_RAWSZ); - 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); @@ -260,17 +21,6 @@ static inline int oidcmp(const struct object_id *oid1, const struct object_id *o 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) -{ - /* - * We write this here instead of deferring to hashcmp so that the - * compiler can properly inline it and avoid calling memcmp. - */ - if (algop->rawsz == GIT_MAX_RAWSZ) - return !memcmp(sha1, sha2, GIT_MAX_RAWSZ); - 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); @@ -296,12 +46,6 @@ 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) @@ -318,13 +62,6 @@ static inline void oidcpy_with_padding(struct object_id *dst, dst->algo = src->algo; } -static inline struct object_id *oiddup(const struct object_id *src) -{ - struct object_id *dst = xmalloc(sizeof(struct object_id)); - oidcpy(dst, src); - return dst; -} - static inline void hashclr(unsigned char *hash) { memset(hash, 0, the_hash_algo->rawsz); @@ -362,12 +99,4 @@ 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); -} - -const char *empty_tree_oid_hex(void); -const char *empty_blob_oid_hex(void); - #endif diff --git a/hashmap.h b/hashmap.h index 7251687d730..9234b94477b 100644 --- a/hashmap.h +++ b/hashmap.h @@ -1,7 +1,7 @@ #ifndef HASHMAP_H #define HASHMAP_H -#include "hash.h" +#include "hash-ll.h" /* * Generic implementation of hash-based key-value mappings. diff --git a/hex.c b/hex.c index 0a1bddc1284..7bb440e7940 100644 --- a/hex.c +++ b/hex.c @@ -1,4 +1,5 @@ #include "git-compat-util.h" +#include "hash.h" #include "hex.h" const signed char hexval_table[256] = { diff --git a/hex.h b/hex.h index e2abfc56fae..7df4b3c460e 100644 --- a/hex.h +++ b/hex.h @@ -1,7 +1,7 @@ #ifndef HEX_H #define HEX_H -#include "hash.h" +#include "hash-ll.h" extern const signed char hexval_table[256]; static inline unsigned int hexval(unsigned char c) 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..56241e6a5c9 100644 --- a/khash.h +++ b/khash.h @@ -27,6 +27,7 @@ #define __AC_KHASH_H #include "hashmap.h" +#include "hash.h" #define AC_VERSION_KHASH_H "0.2.8" diff --git a/ls-refs.c b/ls-refs.c index b9f3e08ec3d..f385938b64c 100644 --- a/ls-refs.c +++ b/ls-refs.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "environment.h" #include "gettext.h" +#include "hash.h" #include "hex.h" #include "repository.h" #include "refs.h" diff --git a/merge-ort-wrappers.c b/merge-ort-wrappers.c index c00dfbab1cd..2c47c5a6237 100644 --- a/merge-ort-wrappers.c +++ b/merge-ort-wrappers.c @@ -1,5 +1,6 @@ #include "cache.h" #include "gettext.h" +#include "hash.h" #include "merge-ort.h" #include "merge-ort-wrappers.h" diff --git a/merge-ort.h b/merge-ort.h index a994c9a5fcd..ce56ec1a780 100644 --- a/merge-ort.h +++ b/merge-ort.h @@ -2,7 +2,7 @@ #define MERGE_ORT_H #include "merge-recursive.h" -#include "hash.h" +#include "hash-ll.h" struct commit; struct tree; 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..5871615feea 100644 --- a/object.h +++ b/object.h @@ -1,9 +1,10 @@ #ifndef OBJECT_H #define OBJECT_H -#include "hash.h" +#include "hash-ll.h" struct buffer_slab; +struct repository; struct parsed_object_pool { struct object **obj_hash; diff --git a/oidmap.c b/oidmap.c index 8c1a139c974..8b1bc4dec94 100644 --- a/oidmap.c +++ b/oidmap.c @@ -1,4 +1,5 @@ #include "git-compat-util.h" +#include "hash.h" #include "oidmap.h" static int oidmap_neq(const void *hashmap_cmp_fn_data UNUSED, diff --git a/oidtree.h b/oidtree.h index 77898f510a1..55c83513fdd 100644 --- a/oidtree.h +++ b/oidtree.h @@ -2,7 +2,7 @@ #define OIDTREE_H #include "cbtree.h" -#include "hash.h" +#include "hash-ll.h" #include "mem-pool.h" struct oidtree { diff --git a/parallel-checkout.c b/parallel-checkout.c index 7f0569cc930..69d569f3525 100644 --- a/parallel-checkout.c +++ b/parallel-checkout.c @@ -3,6 +3,7 @@ #include "config.h" #include "entry.h" #include "gettext.h" +#include "hash.h" #include "hex.h" #include "parallel-checkout.h" #include "pkt-line.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/protocol-caps.c b/protocol-caps.c index 874bc815b4f..3fe0bc61c3f 100644 --- a/protocol-caps.c +++ b/protocol-caps.c @@ -4,7 +4,7 @@ #include "hex.h" #include "pkt-line.h" #include "strvec.h" -#include "hash.h" +#include "hash-ll.h" #include "hex.h" #include "object.h" #include "object-store.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..bca7b851c5a 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -3,6 +3,7 @@ #include "../copy.h" #include "../environment.h" #include "../gettext.h" +#include "../hash.h" #include "../hex.h" #include "../refs.h" #include "refs-internal.h" diff --git a/refs/packed-backend.c b/refs/packed-backend.c index 2333ed5a1f7..704424f55c0 100644 --- a/refs/packed-backend.c +++ b/refs/packed-backend.c @@ -2,6 +2,7 @@ #include "../alloc.h" #include "../config.h" #include "../gettext.h" +#include "../hash.h" #include "../hex.h" #include "../refs.h" #include "refs-internal.h" diff --git a/refs/ref-cache.c b/refs/ref-cache.c index dc1ca49c85f..2294c4564fb 100644 --- a/refs/ref-cache.c +++ b/refs/ref-cache.c @@ -1,6 +1,8 @@ #include "../git-compat-util.h" #include "../alloc.h" +#include "../hash.h" #include "../refs.h" +#include "../repository.h" #include "refs-internal.h" #include "ref-cache.h" #include "../iterator.h" diff --git a/refs/ref-cache.h b/refs/ref-cache.h index cf4ad9070b9..95c76e27c83 100644 --- a/refs/ref-cache.h +++ b/refs/ref-cache.h @@ -1,10 +1,11 @@ #ifndef REFS_REF_CACHE_H #define REFS_REF_CACHE_H -#include "hash.h" +#include "hash-ll.h" 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..31b61d782c7 100644 --- a/refspec.c +++ b/refspec.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "alloc.h" #include "gettext.h" +#include "hash.h" #include "hex.h" #include "strvec.h" #include "refs.h" diff --git a/reftable/dump.c b/reftable/dump.c index 155953d1b82..ce936b4e188 100644 --- a/reftable/dump.c +++ b/reftable/dump.c @@ -7,7 +7,7 @@ https://developers.google.com/open-source/licenses/bsd */ #include "git-compat-util.h" -#include "hash.h" +#include "hash-ll.h" #include "reftable-blocksource.h" #include "reftable-error.h" diff --git a/reftable/system.h b/reftable/system.h index 18f9207dfee..6b74a815143 100644 --- a/reftable/system.h +++ b/reftable/system.h @@ -13,7 +13,7 @@ https://developers.google.com/open-source/licenses/bsd #include "git-compat-util.h" #include "strbuf.h" -#include "hash.h" /* hash ID, sizes.*/ +#include "hash-ll.h" /* hash ID, sizes.*/ #include "dir.h" /* remove_dir_recursively, for tests.*/ int hash_size(uint32_t id); diff --git a/reset.h b/reset.h index a28f81829d8..10708d8ddc0 100644 --- a/reset.h +++ b/reset.h @@ -1,7 +1,7 @@ #ifndef RESET_H #define RESET_H -#include "hash.h" +#include "hash-ll.h" #include "repository.h" #define GIT_REFLOG_ACTION_ENVIRONMENT "GIT_REFLOG_ACTION" diff --git a/resolve-undo.c b/resolve-undo.c index e81096e2d45..70a6db526d2 100644 --- a/resolve-undo.c +++ b/resolve-undo.c @@ -1,5 +1,6 @@ #include "cache.h" #include "dir.h" +#include "hash.h" #include "resolve-undo.h" #include "string-list.h" diff --git a/resolve-undo.h b/resolve-undo.h index d1ea9727712..c5deafc92fe 100644 --- a/resolve-undo.h +++ b/resolve-undo.h @@ -6,7 +6,7 @@ struct index_state; struct pathspec; struct string_list; -#include "hash.h" +#include "hash-ll.h" struct resolve_undo_info { unsigned int mode[3]; diff --git a/split-index.c b/split-index.c index 3fc4e91485a..40e54760b35 100644 --- a/split-index.c +++ b/split-index.c @@ -1,6 +1,7 @@ #include "cache.h" #include "alloc.h" #include "gettext.h" +#include "hash.h" #include "mem-pool.h" #include "split-index.h" #include "strbuf.h" diff --git a/split-index.h b/split-index.h index 1a153f47ba3..15a29cd08c9 100644 --- a/split-index.h +++ b/split-index.h @@ -1,7 +1,7 @@ #ifndef SPLIT_INDEX_H #define SPLIT_INDEX_H -#include "hash.h" +#include "hash-ll.h" struct index_state; struct strbuf; 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..4caf13c663b 100644 --- a/t/helper/test-dump-cache-tree.c +++ b/t/helper/test-dump-cache-tree.c @@ -1,9 +1,11 @@ #define USE_THE_INDEX_VARIABLE #include "test-tool.h" #include "cache.h" +#include "hash.h" #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..1bacd35a53e 100644 --- a/t/helper/test-submodule-config.c +++ b/t/helper/test-submodule-config.c @@ -1,6 +1,8 @@ #include "test-tool.h" #include "config.h" +#include "hash.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..01a9d8eb442 100644 --- a/tree-walk.h +++ b/tree-walk.h @@ -1,9 +1,10 @@ #ifndef TREE_WALK_H #define TREE_WALK_H -#include "hash.h" +#include "hash-ll.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" diff --git a/xdiff-interface.h b/xdiff-interface.h index 3750794afe9..733c364d26c 100644 --- a/xdiff-interface.h +++ b/xdiff-interface.h @@ -1,7 +1,7 @@ #ifndef XDIFF_INTERFACE_H #define XDIFF_INTERFACE_H -#include "hash.h" +#include "hash-ll.h" #include "xdiff/xdiff.h" /* From patchwork Sat Apr 22 20:17: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: 13221089 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 D5679C77B78 for ; Sat, 22 Apr 2023 20:18:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229894AbjDVUSI (ORCPT ); Sat, 22 Apr 2023 16:18:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229934AbjDVURt (ORCPT ); Sat, 22 Apr 2023 16:17:49 -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 139792680 for ; Sat, 22 Apr 2023 13:17:46 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3f09b4a156eso19327085e9.3 for ; Sat, 22 Apr 2023 13:17:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194664; x=1684786664; 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=SkgTBztC8tj6LKC0MoqO/MgFL6oph+J6UvS3VuLt2s+BxLT1+xEuNK3OfrLE/UjzJk PuQ9yjDm1fJX/phTOIWHRfJ4O7NOGRdMnwW8zvjQvuMoL88XeBtszto0sxuxh5j4ABYN OCNBzIIEONzYBM0HA+KnoEPWY6V/M9ZkPG4oXnvd4Nh4rbU1F0YNBIqYSWa4vW2KM0pf Hu9LheW4C5Wl+cjQ2Ou7Q4rjLaighRfX9lGqZC81YEAMFGZa/9f1gOlu/YavvAG9XUw9 Uc7MhCqmMXiVxR3zZDQ7gwGwcca2iiveyNxYm4Ndlsaotz958a7EcZs0hgHVc/bUalp/ 1jdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194664; x=1684786664; 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=HEvF+VR6ar4ecxhIzCIAMkxU6p1qjYVWRxFBZJsEjaI942cy2Njmmh7d4Z7IaslEAX RlCHiOc8DDhS9FBsDHPhH9ScAAd2oMiAEGKhKmh0iBeRo21HNjZ+vtNUS9OWRQMmeNQN VRv2w3e8fNHUx+POiLqDR3/dsRDqQb60Eflvso3/fsZNYrARJ4xpy2bgCUqQVPLjNFiX NUPWd9jV9q5CT5ZmGrmsbONeG8r9UknxOStXudBf2vxcGe9mz9XaKxXjUJgdffCoVncu kYDO6gEUp5wZrNKRDEg3QrH4vWbr8mgvTgDJnAkMem1OlMRIdSo1loabnSewStTgBOqi wtlQ== X-Gm-Message-State: AAQBX9cc5mwAdv5FST8U56o0Kk/Uu5HFrSLuX41dBV4xZhD9xlS38Wv5 0qjVJA1X7i0GqXXM3ef5qwfOsrdsopI= X-Google-Smtp-Source: AKy350ZKShebpGp/lSigNN5lJLZxY7VTfzg6l5yoVUzYIS+AizmYDO5YfSFIAP4R3yEII2fupFMYhw== X-Received: by 2002:a7b:c4c4:0:b0:3f1:70e8:c1ac with SMTP id g4-20020a7bc4c4000000b003f170e8c1acmr4833116wmk.8.1682194663937; Sat, 22 Apr 2023 13:17:43 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n20-20020a7bc5d4000000b003f17b96793dsm11359229wmk.37.2023.04.22.13.17.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:43 -0700 (PDT) Message-Id: <5ef0e17d0aa068bc4b1d78456932d3611098c5f6.1682194652.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:21 +0000 Subject: [PATCH v2 14/22] 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 , Derrick Stolee , Elijah Newren , Glen Choo , 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 Sat Apr 22 20:17: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: 13221090 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 CC31CC7618E for ; Sat, 22 Apr 2023 20:18:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229451AbjDVUSK (ORCPT ); Sat, 22 Apr 2023 16:18:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229932AbjDVURt (ORCPT ); Sat, 22 Apr 2023 16:17:49 -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 CEA5226B2 for ; Sat, 22 Apr 2023 13:17:45 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3f19afc4fd8so3325145e9.2 for ; Sat, 22 Apr 2023 13:17:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194665; x=1684786665; 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=KKn2UwH52sOxMz3HPt7F3ThPF2wIYlX+DKl9kmeIh63BWKfUAGuM0E698JS6pNACd2 /q2XzozjOPJy896Q8RhgXTaqdeEWMOUdeXi5ubdj9Bqoja4gyjIxXZFIAMR5woXiaWeQ yQPX8xHdaOZb2aTM9K2uGWOjhOCLXdWePqQKsEsY6MTGhxVVRYNTfIYcY8ZtMmL1991T PS02WKUQHJJG7VBs63uKNwByZ6s+p2053FKdhWaMJ3DsxQ9SQgNRQlOhvXGUF1QQmile WVL3JyurKeXdxgSJmdOtn0GWsrE9FEC1a4zBEM1uLJOz6ftSCwSjJn5XmPe83Gw3X5Y1 wSzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194665; x=1684786665; 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=Rg/UO8iCgiJSEyib+y8r6STWmTuhAqgGgkVpzbmGTCHGAnQ9rEmzsL1N4ueviiwmOX Fg58RlY4gIsXkpLYXBjfu6J3D9aDn04wfenl/+S30ymG8gtfk6ab+I3YojF34wnCNYgK 9JeVrhuO70K12ZjuTzZgylBmysgeU1PfQyvj9HIna5YSr+r/Ga86aUUbiZXBlcvGPHFF tnef0EXvMG8SurxqMcnx7Km4L1wmhVMzzcl421D+/Usr8LcUqM+0u5sqYYFW9miEyOyQ jl+J1LsJ1SO7PtGb4A9E9fZCnnlyxuKEQFU15+VQH2UYDW9q6BAVus22HCNIP+b5XIbO d7Vg== X-Gm-Message-State: AAQBX9ffbkNrLzwqpeVOXk0EPEx3HjjhukmHzv8c8vjKexhN/IcIlYDT rVmV5CyNXFTovlNU6nF5KCCmfFM/ZzI= X-Google-Smtp-Source: AKy350bQvj0iSKUnfthaa9/9+TqJRN9VW1EV5nwmtTg++TanWMkWnE0L+MwNDXcVrM7DNoDPGBVd2w== X-Received: by 2002:a1c:f715:0:b0:3f1:4971:5cd1 with SMTP id v21-20020a1cf715000000b003f149715cd1mr4570067wmh.21.1682194664806; Sat, 22 Apr 2023 13:17:44 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id v16-20020a05600c471000b003ede3f5c81fsm11548387wmo.41.2023.04.22.13.17.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:44 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:22 +0000 Subject: [PATCH v2 15/22] 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 , Derrick Stolee , Elijah Newren , Glen Choo , 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 Sat Apr 22 20:17: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: 13221092 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 E8245C77B78 for ; Sat, 22 Apr 2023 20:18:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229999AbjDVUSP (ORCPT ); Sat, 22 Apr 2023 16:18:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229942AbjDVURv (ORCPT ); Sat, 22 Apr 2023 16:17:51 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D1AB213C for ; Sat, 22 Apr 2023 13:17:47 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-2f9b9aa9d75so1819055f8f.0 for ; Sat, 22 Apr 2023 13:17:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194665; x=1684786665; 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=T4FzPlqZty/86sVFK5dW0jyKB0FeJSnF9RyXBVTEWeQoilf6BD7Zms+FTuJkXnnn1N Eb5rdMyS3ZnLQoOPjtwCw0P2khae+9m56h6GtLdzJelmIyYOz+AN/bn1HPw6ws/ko2mY Ev6GbRSOLkEdgHftZPat9SzGJd+LICKFkYYi+E2Mrnn7h+U5VbN/Ztxh75o48bRRZKhK 0jVBgKLsfPVesJh5wwSiRgTqltVmHIY2hVVICLQrgy8NQzz45KhUWvs7Y7BxpWNLt5yN TGxWJamyCAtVIu3N/bQVYFkhT6Vx0avcjbV86I0s4Qgr3SRKzhKvrZw4yqLG5sCGM/yR XCtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194665; x=1684786665; 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=T9z0L5syIq3UjFK0ZuE9aPMfnvoLV/h0oDivdHHvbJ/CaI68MlUisW10Jv6q86I9yy FEkeaYPXKj9Q1qK4DkXkkKVoYOkXJ1t6yeGmhzVaLd2oVgi44RbhLKT7zp9kQ9PceR9h F4W0Mgb/Oabp/oKIQB95ut41+q/dqvnF7Ho6EfOsKLANL3VCAcv4vaFGgZJXNEJjKYq2 HLX/s6foWIVMhuRjqYCoOdJ0l9OKLP+y1ifdAgeHOPnmMVcVjpyHfwpSMHz4WhgUZ4OU TSwrjAySUvlHTQirD65XgERa6As4itDaAjY+BfslHbNvLq27HvP6C2+dkti6mtP7Eahs 3+Bg== X-Gm-Message-State: AAQBX9e2rmILxuC0OFT7vCeBHrtCLlonnTDeEnH85suH1umL3gXgK4DC dchl/qGwg0FcKsQyPrZBiZqwOGYFPHo= X-Google-Smtp-Source: AKy350Z6ID1Tm5l0aeSauNYtc0mwFp/NN2J7e6C3dFoDm02kn48113ln67uNT3vn7DM6TXCeBIfigw== X-Received: by 2002:adf:f88a:0:b0:2f9:827a:e999 with SMTP id u10-20020adff88a000000b002f9827ae999mr6708574wrp.60.1682194665495; Sat, 22 Apr 2023 13:17:45 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id v19-20020a05600c215300b003ee20b4b2dasm8026838wml.46.2023.04.22.13.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:45 -0700 (PDT) Message-Id: <960b5438ce494a29cc93501cdf4ba4745740f374.1682194652.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:23 +0000 Subject: [PATCH v2 16/22] treewide: remove cache.h inclusion due to previous changes Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Derrick Stolee , Elijah Newren , Glen Choo , 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 Sat Apr 22 20:17: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: 13221093 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 2A683C6FD18 for ; Sat, 22 Apr 2023 20:18:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230015AbjDVUSS (ORCPT ); Sat, 22 Apr 2023 16:18:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229938AbjDVURv (ORCPT ); Sat, 22 Apr 2023 16:17:51 -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 B11A21FDF for ; Sat, 22 Apr 2023 13:17:47 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-2f55ffdbaedso1815334f8f.2 for ; Sat, 22 Apr 2023 13:17:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194666; x=1684786666; 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=Yig/8OeRRuZHd6Toos3xGPkVBJdfTHnB9c+5MQfkkPnS1Ae01/Hf+0y6BFVYzterhg v1vtmKiUaKoCH1gDTzsH7U+C2ToHVdry11BYM24vlNaoufBmRrageIMyUeKyJwiCjD8w oEO7JZZGZtYHU2wqoug0uWX1S2CnJI8p41Z86skwwFaVOV0MkChOMPMJaB5NHys1VDBY Thu4ZsGYm9RX6TjsTgqVzpNv4QOu8hRkPdvRnLtFJFlVCdyCgu8H3n1qOfBIGZDkanuE MB3NLYcEusPVdLXpZuYzexJYfCUxF6NpBLB6xlzubfRqJJ9JBkazeSmhtFDbfOZo0vbi 0eLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194666; x=1684786666; 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=Byc7UitEWEUm6cHAgCHvFzxCspdF5+K1qJZytuJ4mhvUeTQCpEdvcZE3Tc8vHQ4BRF tNv92wWECmuBzWt1b+UMrSkkeWbjL1zx8aAVZBkxUi4WQv4FInS4DVkwKJipXRIFIRMB DWo+92NcAQbToGzqgEUXDTZgYsG89lREsI6LJyxH74f1S7tZtHqBpwR4IjIZDGjxkMeN 4f7xVuqYJr+yoiJ4YsM8y3lRJAMyKGonKBODIororRRwHVjKZXEAr7ssOfTVENOPCz12 8zCOZNwsxCvUwiCsG19QZ4l4FlvG/y4X01RswbYWfLNHRc6+7CMHXPGH3jc5NJj4tgEH 8deA== X-Gm-Message-State: AAQBX9cIoLJandCxvxA5vrmq+BxAU5lb67s2hDlrmXacSFDTxI97DmnK b1XBPN3NyggdhEu1rvcKstS7OAzZjpw= X-Google-Smtp-Source: AKy350a1n40VwBtxyw/uP0Rmd94h18qW7+0/84BIbBqauPYP6aIL9+FwRm5E8uWCxc+UliF3N1sNSw== X-Received: by 2002:adf:e2ce:0:b0:2ef:ae9e:b191 with SMTP id d14-20020adfe2ce000000b002efae9eb191mr5993861wrj.45.1682194666166; Sat, 22 Apr 2023 13:17:46 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m4-20020adffa04000000b002fe96f0b3acsm7197463wrr.63.2023.04.22.13.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:45 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:24 +0000 Subject: [PATCH v2 17/22] cache.h: remove unnecessary headers Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Derrick Stolee , Elijah Newren , Glen Choo , 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 Sat Apr 22 20:17: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: 13221094 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 85449C77B78 for ; Sat, 22 Apr 2023 20:18:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230016AbjDVUST (ORCPT ); Sat, 22 Apr 2023 16:18:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229948AbjDVURv (ORCPT ); Sat, 22 Apr 2023 16:17:51 -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 7FFC6211C for ; Sat, 22 Apr 2023 13:17:48 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3f196e8e2c6so11967165e9.1 for ; Sat, 22 Apr 2023 13:17:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194667; x=1684786667; 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=izfYd6PuUdq0wQBjTXe93iXlYqhQNlXM6aOxNeoshnqBfh1C/BV23omE9RZ8KaqnQc L6XgGhwQxAVeAnEhwvGR8WQqv8h1E8N889l2E1s2zOpJzw8v0rZqAqgCThtDv8a5xnrr 9xmkK1sMhxY5fkAfQAyHstFwEuj98GWebsefd0YeJuMnBWSan4+qCdaaPvvrTiUt7Fkb +FIfgnNeH941TsqVJ5BIs0batQfG3IebL49+K15ojfyS/9NcCvGB0D+GqT7ORBodJh80 gEV8XAGqPwWYqddH3mBNIyq7WCoPlRGLFTZFnPOWCDB+ttL9ce356Pak3v7FZPHWxr+J GS5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194667; x=1684786667; 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=L65SozV/tv279ZY1YRiuoli+tgMHgcjV9eEpBARtjpuD8WHdwT/pUwmJ/K71/oYkKb TSB865y6jVovx/GyRjiSuBr9E0FrdEfHX8fMST2GoXVGhSvm9FqLGpYMfNzMJVuNTtEe r0iAsYIjjsS9bUwsascS7zIyJ89JvU8RfGkLTyq1tJJXjffKmYqk0rWEOHY1/9WdjOc7 2SwpyOb8bAXiTjUQiGvXugGy/Ec04LPs4GL5zQ3RHOIDHkjFo1M7MNj6ZvxAXfUBp1Kt if7Mz7PHpadglE8lCX7eFUX5hVtks0NTSVdr4zHX4K4m3qRHNBneZRlrD/OEJH9/s8/M jwbw== X-Gm-Message-State: AAQBX9dkSSxlGbSLwqnYYQstndqYu3uvbhgtd/X5SslsbPFx2UciBCWG oiDe2+LWE6KUqgwCMWtqFe+MAtQDFRs= X-Google-Smtp-Source: AKy350a+ySs77d7yB5i0rSKngXo9jJU/grmGLqABB9zUUyKyArZS4cPpJdWAVBqR0zNBpldT3VV4XA== X-Received: by 2002:a7b:c84c:0:b0:3f1:73c1:d1ad with SMTP id c12-20020a7bc84c000000b003f173c1d1admr4589651wml.35.1682194666892; Sat, 22 Apr 2023 13:17:46 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id z19-20020a1c4c13000000b003f173419e7asm7972682wmf.43.2023.04.22.13.17.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:46 -0700 (PDT) Message-Id: <80ebd46c862456bc726748ed11d7cf1bb1ba0e86.1682194652.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:25 +0000 Subject: [PATCH v2 18/22] fsmonitor: reduce includes of cache.h Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Derrick Stolee , Elijah Newren , Glen Choo , 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 Sat Apr 22 20:17:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13221097 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 0747AC6FD18 for ; Sat, 22 Apr 2023 20:18:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230036AbjDVUS0 (ORCPT ); Sat, 22 Apr 2023 16:18:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229949AbjDVURx (ORCPT ); Sat, 22 Apr 2023 16:17:53 -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 7538D2135 for ; Sat, 22 Apr 2023 13:17:49 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3f09b4a1527so30992975e9.0 for ; Sat, 22 Apr 2023 13:17:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194667; x=1684786667; 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=MtURBi+l7YRN0MeavWtCjixTDIn2F7qA/UQEf/e9tEE=; b=kK0mwRuSjbNaAbFsCiXyntWJzZMaM9XMv9vCmYOimmEI/lwDzHKncZmZ7DGs6Hz5Sh 6Mylx4bd8HKHZg4qb2gDa04wSRKMwlOStDOX0/fa96yv/yznLY6H6FQHNt41+7fF+Akl 8+JN1ZIIkkDoODNmT3hs9GUdO6lN+dxv0RdrK5rDKLjYJYVzpCXseraB4no8mKU205Yb U7Jk3kVWi0VPjAT0f/cZznbizmaCitBegkRo0sVqaIwdt2XxcD3t4O0mYzzqoWeqiMbl AFcjnHkczZcY+C51hA38OUHzDVYSwalB/xkeuUrJLB3AZfTF/DH0IpxlJWLyHdqtXzFa tbGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194667; x=1684786667; 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=MtURBi+l7YRN0MeavWtCjixTDIn2F7qA/UQEf/e9tEE=; b=lkTqqdUTJ151B4oSV2EglhkcepVPKUaL69LE8wW5sF3rP9SGMKan13b2IcSWb3qhnm Wi4qPyoopH2sQOOcnPBetAnMsh5iPc4DX3epmunkB67mCeEscgdNJTk1flnMe8Lw6eTO xPbyXfjSaGTIeQooa9zNPxTXCuSrB2nyMcl/Tmui3D8RGquqmErIwNPkGgJQSM2QeyP1 4xDpGsIkl3CPLixBCltXKut2uTNR4k5iFhVgVGOTSP+RgJEaTtXWj77kl400qCXlP3d8 2ovl189JWnrXKn+yf1aW3oaBEyP/Mgyf/NUj7TE0/xpF7Y8m5zjM3PkCs1t0inrzbB7n 6CJg== X-Gm-Message-State: AAQBX9eQtW1PsU4WA8fjPiyWc/LprblZcssxnrI0sgi9tF4yXrKdzqUM LjyDB07Ax+VpBNCF2YEsVzWk3AEZoPg= X-Google-Smtp-Source: AKy350ZWcVo6Hylw6+Ww2g3iCPoiH83F/myPfmL5BLj+LlfvjEFZryMaYZCNcURwVU1YgGLbImb+tA== X-Received: by 2002:a1c:7310:0:b0:3f1:8af9:55ae with SMTP id d16-20020a1c7310000000b003f18af955aemr4857199wmb.18.1682194667579; Sat, 22 Apr 2023 13:17:47 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 11-20020a05600c228b00b003f1736fdfedsm8089246wmf.10.2023.04.22.13.17.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:47 -0700 (PDT) Message-Id: <7479e72ffd612addd9d71118647849d99c5870f8.1682194652.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:26 +0000 Subject: [PATCH v2 19/22] commit.h: reduce unnecessary includes Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Derrick Stolee , Elijah Newren , Glen Choo , 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 2c47c5a6237..a5507533009 100644 --- a/merge-ort-wrappers.c +++ b/merge-ort-wrappers.c @@ -3,6 +3,7 @@ #include "hash.h" #include "merge-ort.h" #include "merge-ort-wrappers.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 31b61d782c7..57f6c2aaf9b 100644 --- a/refspec.c +++ b/refspec.c @@ -6,6 +6,7 @@ #include "strvec.h" #include "refs.h" #include "refspec.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 Sat Apr 22 20:17:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13221095 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 3BE8FC6FD18 for ; Sat, 22 Apr 2023 20:18:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230019AbjDVUSV (ORCPT ); Sat, 22 Apr 2023 16:18:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229912AbjDVURx (ORCPT ); Sat, 22 Apr 2023 16:17:53 -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 2DF222707 for ; Sat, 22 Apr 2023 13:17:50 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3f1950f569eso10529395e9.2 for ; Sat, 22 Apr 2023 13:17:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194668; x=1684786668; 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=MlRE+RXU4qmurHOQw1ZzX7gCPyXVWF3M/mWNqs9QXylIISxxQMBi1dUUvNbMFAMf5A mjKHk18il66D1LudQo2awnaGh+0P2AIPcS92HJ1pPWQi2aVTj5FXO6OXKzG7HQIv1AiF 53UPsyPUwBylQ8gTbaHus43IWTIvV2OsIn2M4iOhUT6jcUiNFXcGfHPZ3Thnp2CWl4O+ 5LGLnwfxEuazIKoH5ejKIJGmsH5JBfnvzWTRQzoWL9EoCryaxdmcwv/KJqBwWk8va8QW s43Xt7e+OdD4svBo8xc5DtgDkR85Alwc+cgV4LtqPgXo+SQr1VrWvPAWRPYCmC82J0mx ICIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194668; x=1684786668; 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=eR5lmbcdOCzZiFO9E0YJzJuH8IKedEBus1DLdE1FcMCP3SpoEjLLWKLb+LeLdnj8Lr CM+wAIq2tEwEzod46dq19Gkv/v+v82lSGMT8rw9F0nVG0o6G+4I/lD7PqVj1+Lou7N4G hsG/7X89mBOlFeKPbA4sHpuaqiiUGLOvHltlR4myaqa4oyUfKuaZPybNjScgBkyHpLJq SPToBw+ykiK97frzAY2dx7lnvLor3+x0Bpq9LkUc/MswcPl534bdOEw8ZLzqCtxmrf5q WGg7yzy0B0BWE7zkRtExCpERirKUfbjPz7/64+WzyUmDI14WijAnd8NPZF9OcSLQHmgm 9GIA== X-Gm-Message-State: AAQBX9eS69p+aImR4hM/JI5i0rWWMRlYT1f2un9aErbwd/4JJ+XDTnSn IFPY3Fw9DaRhnuNGQcbLvMqoZZd0zkg= X-Google-Smtp-Source: AKy350Yp10azjKDRjpSm+XMj/lIValaI1C2HC5Zo+3KIG/lN2V0RiQTftZxL+9Kg71T82lxdteFAHA== X-Received: by 2002:a5d:4b91:0:b0:2f9:61d4:1183 with SMTP id b17-20020a5d4b91000000b002f961d41183mr6351891wrt.45.1682194668442; Sat, 22 Apr 2023 13:17:48 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id w6-20020adfee46000000b002f0442a2d3asm7224269wro.48.2023.04.22.13.17.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:48 -0700 (PDT) Message-Id: <7705cbc2733a52cbaa53adc3dffab58f41eb4105.1682194652.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:27 +0000 Subject: [PATCH v2 20/22] object-store.h: reduce unnecessary includes Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Derrick Stolee , Elijah Newren , Glen Choo , 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 Sat Apr 22 20:17:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13221099 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 EDBABC7618E for ; Sat, 22 Apr 2023 20:18:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230075AbjDVUSa (ORCPT ); Sat, 22 Apr 2023 16:18:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229879AbjDVUR4 (ORCPT ); Sat, 22 Apr 2023 16:17:56 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBC822110 for ; Sat, 22 Apr 2023 13:17:50 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-2f7db354092so1772425f8f.2 for ; Sat, 22 Apr 2023 13:17:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194669; x=1684786669; 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=HsXYFW+xxbIg+/668TFe/h1U8VTpUsyPWPGt4v0vHUzYxKCTsYHhQO15aNNKSkfoj3 p0bzot/D5k/QlkV7+ESR+mnbXn03XNJIxvVSR2xjz1B2hXG9xDC1idyUvrZV6qlv4ZVT EeEUJ34epqfAsTx//UGgkcpDUI6WccSLAE7Zjb7hpFfAr8TfX+wAU76FyBi0W0wRWCR8 pa9XarkOgGXqkIacsII/vr1NIMPY95FGi/a31EcXiSNf6SprfTauOWJQcQS628F/MHVy 4ngfUwUr0SK4MCX/J2OZ4llArZGqUiwucPL4KNM17YW5hfE8iSlvz1q+xcW2g4vGtXy8 GEFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194669; x=1684786669; 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=djML0v0SsUpbzQoJkNlZf6h6/a/zexy7s7Wv0mKe4c8T1Cu35u8epwka1iBFXX3KFQ ZIdKhd62aJRmG8G3gWR0cvgFyeLEXPSEvSFA2zuQAZGwbbONgIso6ciuLjRtD00W2ugO rzlD4EhAGSu10D/Ysca3ol90u/Lxg4KLF5Up3xWG2avg/ZZ55lkdm/zPh96haMQriEwx 7+6KME9BusL+ct9zXt1n1xM/z68dPmudYUMs2SrpGmU6mR83qXWL+jSciaLxekn5dv3p tUYI4RLChXmvB0TzeUSLJ50takdI+LYWWHr2v5+aqqnKY1CQBZH4jRw2FTUM3Je08THs trYA== X-Gm-Message-State: AAQBX9dyFy0d3UF4BC57YR48d43lw23Rm8bsBa8pViNQuEgYwHmwG1bj a9Qc7Dt2zFirmZbAaY9Y6AznKPeJ4IY= X-Google-Smtp-Source: AKy350Y5b5qc78Vdaks/ctLJkH8+gqtyaJxTIyzs0vqrgzZW1b56prl1aZmacFe+w1oNjf9M9U/gqQ== X-Received: by 2002:a5d:508c:0:b0:2f4:bc68:3493 with SMTP id a12-20020a5d508c000000b002f4bc683493mr6848178wrt.34.1682194669119; Sat, 22 Apr 2023 13:17:49 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id v11-20020a5d43cb000000b002ff77b033b1sm7241114wrr.33.2023.04.22.13.17.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:48 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:28 +0000 Subject: [PATCH v2 21/22] diff.h: reduce unnecessary includes Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Calvin Wan , Derrick Stolee , Elijah Newren , Glen Choo , 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 Sat Apr 22 20:17:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13221098 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 BC081C77B78 for ; Sat, 22 Apr 2023 20:18:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229884AbjDVUS2 (ORCPT ); Sat, 22 Apr 2023 16:18:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbjDVURy (ORCPT ); Sat, 22 Apr 2023 16:17:54 -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 8538B270E for ; Sat, 22 Apr 2023 13:17:50 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3f09b4a156eso19327275e9.3 for ; Sat, 22 Apr 2023 13:17:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682194670; x=1684786670; 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=B2Afx5zqtFPPE2Y1V/RwWagtsAJEDHZhc0+1SNEHkaY+2gQ4GgWPT6nPjPFrmuFMcf EgelvqnrnqHcohlzVu3lOHUJ5H10l3kuxFCpjYOUBJnjCoNPCma/MOF0tULabD0VORyn BTxSB/rSJyGCO/H3/RACY1wmJNvBvVdI618TKhaf4mSGyQlFhD9bUKC0mWUBKK1DsuaL bvmX+Nr5ON3mV7uUyXuldEg2cuHb3tWGrWgc1w90uDJ4NHv9ssnpwxf1rJkrqvW0rD21 wyIx5EzTboiJ/arZB9Yx21yH94QCAdGZaTjWTy2nAug/PWmIpBRET2HkELkNvdWFjs/R v0tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682194670; x=1684786670; 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=BHzjh2DF1Mq9VOs3oOmmwAJR+U7h8YOC8NCJQSbDAO/wkXOz3YvKUqPeVY6mgVVuLQ vvTpvg+gXZNiQXyNMK15dOCv/d83TSNKW9cRRAT7rsEz4GAWIHi95vAHzAuaJ6fvlhXm pbSORPx33YtBBY27O3+9gC/s6m0Rce6PdFCeQv5b995MTaNVAVxhGCf62qR3xmQKO9iY ZFoO5XbUF3O3evtPzYaFio6OdpdOdXWQGNsunSTi5jGUtLhRZST/EaqUTnaeye31bBpZ vGceeLpp6CGKKt6HI2M0hlTbJdAi1KG0vf6qHvmWJToHcLePYC8XAz4uPgOyUv8fgAat CYNw== X-Gm-Message-State: AAQBX9flom/wQyQfW1yvjhsQbvSM/OC6rehiyIC8JiKfYiclbrT9+wWZ H3yqYjUeab5k8ZMrhf7Gdfwehfkef7I= X-Google-Smtp-Source: AKy350YeXi8gdvQrWXW1up7Xp9e+zQ1qRbqU61TKuZUAFryuj6b/AvnxzLgyWeV9U5f7gk1t3dAgVA== X-Received: by 2002:a05:600c:2212:b0:3f1:72ec:4024 with SMTP id z18-20020a05600c221200b003f172ec4024mr4540193wml.21.1682194669856; Sat, 22 Apr 2023 13:17:49 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 21-20020a05600c22d500b003f17131952fsm8074556wmg.29.2023.04.22.13.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 13:17:49 -0700 (PDT) Message-Id: <67d52c6e751fae6e3325178a24eeb5f44afb3f08.1682194652.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 22 Apr 2023 20:17:29 +0000 Subject: [PATCH v2 22/22] 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 , Derrick Stolee , Elijah Newren , Glen Choo , 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"