git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] odb: do not list our own refs as alternate refs in the quarantine

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 3, 2026, 01:12 UTC
Message-ID
<xmqqld7aen0n.fsf@gitster.g>
In-Reply-To
<xmqq1p92g375.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 13 quoted lines
> "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
Previous: Junio C HamanoNext: Kristofer Karlsson
Message 10 of 14 in “odb: do not list our own refs as alternate refs in the quarantine”
  1. odb: do not list our own refs as alternate refs in the quarantineKristofer Karlsson via GitGitGadget, Oct 28, 2026
  2. Justin ToblerOct 29, 2026
  3. Kristofer KarlssonOct 30, 2026
  4. Junio C HamanoOct 29, 2026
  5. Kristofer KarlssonOct 30, 2026
  6. Junio C HamanoOct 30, 2026
  7. Jeff KingOct 30, 2026
  8. odb: do not list our own refs as alternate refs in the quarantineKristofer Karlsson via GitGitGadget, Nov 2, 2026
  9. Junio C HamanoNov 3, 2026
  10. Junio C HamanoNov 3, 2026
  11. Kristofer KarlssonNov 3, 2026
  12. Patrick SteinhardtNov 3, 2026
  13. Kristofer KarlssonNov 3, 2026
  14. Patrick SteinhardtNov 3, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.