From: Junio C Hamano <gitster@pobox.com>
To: "Kristofer Karlsson via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Patrick Steinhardt <ps@pks.im>,
Jeff King <peff@peff.net>, Justin Tobler <jltobler@gmail.com>,
Kristofer Karlsson <krka@spotify.com>
Subject: Re: [PATCH v2] odb: do not list our own refs as alternate refs in the quarantine
Date: Mon, 02 Nov 2026 17:12:24 -0800 [thread overview]
Message-ID: <xmqqld7aen0n.fsf@gitster.g> (raw)
In-Reply-To: <xmqq1p92g375.fsf@gitster.g> (Junio C. Hamano's message of "Mon, 02 Nov 2026 16:37:34 -0800")
Junio C Hamano <gitster@pobox.com> writes:
> "Kristofer Karlsson via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
>
>> Changes since v1:
>> ...
>> quarantine outside of the commondir.
>
> All of the above changes make sense to me.
>
> This unfortunately crashes with Patrick's odb-reload-alternates
> series, but let me see if I can get a reasonable conflict resolution
> or if it is more reasonable to ask you to rebase this on the other
> topic.
I decided to queue it as-is instead of asking you to depend on the
other topic. Here is what I got after making a trial merge to
'seen'.
I usually use "git show" to trigger the dense-combined diff format
(i.e., "git show --cc seen"), but "git show --remerge-diff seen"
output is shown below, just to see how easy it is to read.
commit b7f4d1e66b034c2a64b7f3323f9cd156a028f080
Merge: 1707829739 3f91b4bc4b
Author: Junio C Hamano <gitster@pobox.com>
Date: Mon Nov 2 16:37:57 2026 -0800
Merge branch 'kk/quarantine-alternate-refs' into seen
The connectivity check in 'git-receive-pack(1)' has been optimized
to not list the repository's own refs as alternate refs when running
inside the object quarantine, avoiding redundant traversal of hidden
refs.
* kk/quarantine-alternate-refs:
odb: do not list our own refs as alternate refs in the quarantine
diff --git a/Documentation/rev-list-options.adoc b/Documentation/rev-list-options.adoc
remerge CONFLICT (content): Merge conflict in Documentation/rev-list-options.adoc
index 4e92cf6456..d20c5f6372 100644
--- a/Documentation/rev-list-options.adoc
+++ b/Documentation/rev-list-options.adoc
@@ -223,23 +223,13 @@ explicitly.
Pretend as if all objects mentioned as ref tips of alternate
repositories were listed on the command line. An alternate
repository is any repository whose object directory is specified
-<<<<<<< 1707829739 (Merge branch 'kk/connectivity-check-ignore-replace' into seen)
in `objects/info/alternates`. The refs of shallow and grafted
alternate repositories are ignored, as the history behind them
- may be missing. The set of included objects may be modified by
+ may be missing. The repository's own object directory does not
+ count, even when it is passed in as an alternate, as happens
+ inside the object quarantine of linkgit:git-receive-pack[1].
+ The set of included objects may be modified by
`core.alternateRefsCommand`, etc. See linkgit:git-config[1].
-||||||| ebdc087dc9
- in `objects/info/alternates`. The set of included objects may
- be modified by `core.alternateRefsCommand`, etc. See
- linkgit:git-config[1].
-=======
- in `objects/info/alternates`. The repository's own object
- directory does not count, even when it is passed in as an
- alternate, as happens inside the object quarantine of
- linkgit:git-receive-pack[1]. The set of included objects may
- be modified by `core.alternateRefsCommand`, etc. See
- linkgit:git-config[1].
->>>>>>> 3f91b4bc4b (odb: do not list our own refs as alternate refs in the quarantine)
`--single-worktree`::
By default, all working trees will be examined by the
diff --git a/odb/source-files.c b/odb/source-files.c
remerge CONFLICT (content): Merge conflict in odb/source-files.c
index 4239cb493c..8ce437fdc2 100644
--- a/odb/source-files.c
+++ b/odb/source-files.c
@@ -75,15 +75,9 @@ static void odb_source_files_free(struct odb_source *source)
odb_files_dir_free(files->dirs);
files->dirs = next;
}
-<<<<<<< 1707829739 (Merge branch 'kk/connectivity-check-ignore-replace' into seen)
strset_clear(&files->dir_paths);
stat_validity_clear(&files->alternates_validity);
-||||||| ebdc087dc9
- hashmap_clear(&files->dirs_by_path);
-=======
- hashmap_clear(&files->dirs_by_path);
free(files->quarantine_path);
->>>>>>> 3f91b4bc4b (odb: do not list our own refs as alternate refs in the quarantine)
odb_source_release(&files->base);
free(files);
@@ -362,15 +356,6 @@ static void read_alternates(const char *object_dir, struct strvec *out,
free(path);
}
-<<<<<<< 1707829739 (Merge branch 'kk/connectivity-check-ignore-replace' into seen)
-static void add_alternate_recursively(struct odb_source_files *files,
- const char *path,
- int depth)
-||||||| ebdc087dc9
-static void odb_add_alternate_recursively(struct odb_source_files *files,
- const char *path,
- int depth)
-=======
/*
* Our own object directory is <commondir>/objects, or the parent of
* GIT_QUARANTINE_PATH, as an object quarantine is created directly
@@ -410,10 +395,9 @@ static bool is_borrowed_object_dir(struct odb_source_files *files,
return ret;
}
-static void odb_add_alternate_recursively(struct odb_source_files *files,
- const char *path,
- int depth)
->>>>>>> 3f91b4bc4b (odb: do not list our own refs as alternate refs in the quarantine)
+static void add_alternate_recursively(struct odb_source_files *files,
+ const char *path,
+ int depth)
{
struct odb_files_dir *alternate;
struct strvec alternates = STRVEC_INIT;
diff --git a/odb/source-files.h b/odb/source-files.h
remerge CONFLICT (content): Merge conflict in odb/source-files.h
index 7afc2f28ad..9117dbea5b 100644
--- a/odb/source-files.h
+++ b/odb/source-files.h
@@ -70,22 +70,16 @@ struct odb_source_files {
* Whether directory paths shall be compared case-insensitively, as
* determined by "core.ignoreCase".
*/
-<<<<<<< 1707829739 (Merge branch 'kk/connectivity-check-ignore-replace' into seen)
int dir_paths_icase;
/* Stat data of the "info/alternates" file. */
struct stat_validity alternates_validity;
-||||||| ebdc087dc9
- int dirs_paths_icase;
-=======
- int dirs_paths_icase;
/*
* The value of GIT_QUARANTINE_PATH when this source was set up from
* the environment (see ODB_NEW_HONOR_ENV), or NULL.
*/
char *quarantine_path;
->>>>>>> 3f91b4bc4b (odb: do not list our own refs as alternate refs in the quarantine)
};
/* Allocate and initialize a new object source. */
diff --git a/t/t5618-alternate-refs.sh b/t/t5618-alternate-refs.sh
remerge CONFLICT (content): Merge conflict in t/t5618-alternate-refs.sh
index cefc37797c..048c7c63c1 100755
--- a/t/t5618-alternate-refs.sh
+++ b/t/t5618-alternate-refs.sh
@@ -58,34 +58,6 @@ test_expect_success 'log --source shows .alternate marker' '
test_cmp expect actual
'
-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 1707829739 (Merge branch 'kk/connectivity-check-ignore-replace' into seen)
-test_expect_success 'connectivity check of a fetch excludes alternate refs' '
- GIT_TRACE2_EVENT="$(pwd)/fetch.trace" git fetch origin &&
- test_subcommand_flex git rev-list --objects --stdin --not --all \
- --alternate-refs --quiet <fetch.trace
-'
-
-test_expect_success 'connectivity check of a deepening fetch excludes alternate refs' '
- GIT_TRACE2_EVENT="$(pwd)/deepen.trace" git fetch --depth=1 origin one &&
- test_subcommand_flex git rev-list --objects --stdin --not \
- --alternate-refs --quiet <deepen.trace
-'
-
-test_expect_success 'refs of a shallow alternate are ignored' '
- git clone --depth=1 --no-local . shallow &&
- test_commit -C shallow shallow-only &&
- shallow_tip=$(git -C shallow rev-parse HEAD) &&
- cp .git/objects/info/alternates alternates.bak &&
- test_when_finished "mv alternates.bak .git/objects/info/alternates" &&
- echo "$(pwd)/shallow/.git/objects" >>.git/objects/info/alternates &&
- git cat-file -e $shallow_tip &&
- git rev-list --remotes=origin >expect &&
- git rev-list --alternate-refs >actual &&
- test_cmp expect actual
-'
-
-|||||||||||||||||||||||||||||||| ebdc087dc9
-================================
# Our own object directory as an alternate is not a source of alternate
# refs, but the alternates it brings in with it still are.
test_expect_success 'own object directory as alternate lists only real alternates' '
@@ -120,5 +92,29 @@ test_expect_success 'parent of the quarantine is not listed as an alternate' '
test_must_be_empty actual
'
->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 3f91b4bc4b (odb: do not list our own refs as alternate refs in the quarantine)
+test_expect_success 'connectivity check of a fetch excludes alternate refs' '
+ GIT_TRACE2_EVENT="$(pwd)/fetch.trace" git fetch origin &&
+ test_subcommand_flex git rev-list --objects --stdin --not --all \
+ --alternate-refs --quiet <fetch.trace
+'
+
+test_expect_success 'connectivity check of a deepening fetch excludes alternate refs' '
+ GIT_TRACE2_EVENT="$(pwd)/deepen.trace" git fetch --depth=1 origin one &&
+ test_subcommand_flex git rev-list --objects --stdin --not \
+ --alternate-refs --quiet <deepen.trace
+'
+
+test_expect_success 'refs of a shallow alternate are ignored' '
+ git clone --depth=1 --no-local . shallow &&
+ test_commit -C shallow shallow-only &&
+ shallow_tip=$(git -C shallow rev-parse HEAD) &&
+ cp .git/objects/info/alternates alternates.bak &&
+ test_when_finished "mv alternates.bak .git/objects/info/alternates" &&
+ echo "$(pwd)/shallow/.git/objects" >>.git/objects/info/alternates &&
+ git cat-file -e $shallow_tip &&
+ git rev-list --remotes=origin >expect &&
+ git rev-list --alternate-refs >actual &&
+ test_cmp expect actual
+'
+
test_done
next prev parent reply other threads:[~2026-11-03 1:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 15:18 [PATCH] odb: do not list our own refs as alternate refs in the quarantine Kristofer Karlsson via GitGitGadget
2026-10-29 16:57 ` Justin Tobler
2026-10-30 11:29 ` Kristofer Karlsson
2026-10-29 17:24 ` Junio C Hamano
2026-10-30 11:51 ` Kristofer Karlsson
2026-10-30 16:05 ` Junio C Hamano
2026-10-30 18:17 ` Jeff King
2026-11-02 11:45 ` [PATCH v2] " Kristofer Karlsson via GitGitGadget
2026-11-03 0:37 ` Junio C Hamano
2026-11-03 1:12 ` Junio C Hamano [this message]
2026-11-03 10:19 ` Kristofer Karlsson
2026-11-03 11:00 ` Patrick Steinhardt
2026-11-03 12:05 ` Kristofer Karlsson
2026-11-03 12:26 ` Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqld7aen0n.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=jltobler@gmail.com \
--cc=krka@spotify.com \
--cc=peff@peff.net \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox