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

[PATCH] pack-objects: handle missing promisor objects

From
AGAlessio Attilio via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 25, 2026, 19:40 UTC
Message-ID
<pull.2333.git.1795635624820.gitgitgadget@gmail.com>
From: Alessio Attilio <attilio.alessio@protonmail.com>

Objects missing from a partial clone are expected to be absent. When checking whether an object is in a promisor pack, do not BUG() if its object info cannot be read. Such an object cannot be included in the pack, so skip it.

Signed-off-by: Alessio Attilio <attilio.alessio@protonmail.com>
---
    pack-objects: handle missing promisor objects
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2333%2Fkairosci%2Fattilio%2Fpack-objects-missing-promisor-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2333/kairosci/attilio/pack-objects-missing-promisor-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2333
 builtin/pack-objects.c   |  2 +-
 t/t0410-partial-clone.sh | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 65c2ad9a86..5228d7f90d 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -5092,7 +5092,7 @@ static int is_not_in_promisor_pack_obj(struct object *obj, void *data UNUSED)
 	};
 
 	if (odb_read_object_info_extended(the_repository->objects, &obj->oid, &info, 0))
-		BUG("should_include_obj should only be called on existing objects");
+		return 0;
 	return source_info.source->type != ODB_SOURCE_PACKED || !source_info.u.packed.pack->pack_promisor;
 }
 
diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh
index 788e9a1631..a858aa0a85 100755
--- a/t/t0410-partial-clone.sh
+++ b/t/t0410-partial-clone.sh
@@ -32,6 +32,26 @@ promise_and_delete () {
 	delete_object repo "$HASH"
 }
 
+test_expect_success 'fetch --unshallow with tree filter when remote has advanced' '
+	rm -rf server server.bare client &&
+	test_create_repo server &&
+	test_commit -C server c1 &&
+	test_commit -C server c2 &&
+	test_commit -C server c3 &&
+	test_commit -C server c4 &&
+	git clone --bare server server.bare &&
+	git -C server.bare config uploadpack.allowfilter true &&
+	git -C server.bare config uploadpack.allowanysha1inwant true &&
+	git init client &&
+	git -C client remote add origin "file://$(pwd)/server.bare" &&
+	tip=$(git -C server rev-parse HEAD~1) &&
+	git -C client fetch --no-tags --depth=1 origin "+$tip:refs/remotes/origin/master" &&
+	git -C client checkout -b master refs/remotes/origin/master &&
+	git -C client fetch --no-tags --filter=tree:0 --unshallow origin \
+		+refs/heads/master:refs/remotes/origin/master &&
+	rm -rf server server.bare client
+'
+
 test_expect_success 'extensions.partialclone without filter' '
 	test_create_repo server &&
 	git clone --filter="blob:none" "file://$(pwd)/server" client &&

base-commit: 1630431f326e15fcde608827b5ff38422528eb59
-- 
gitgitgadget
Next: Alessio Attilio via GitGitGadget
Message 1 of 8 in “pack-objects: handle missing promisor objects”
  1. pack-objects: handle missing promisor objectsAlessio Attilio via GitGitGadget, Nov 25, 2026
  2. pack-objects: handle missing promisor objectsAlessio Attilio via GitGitGadget, Nov 25, 2026
  3. Junio C HamanoNov 25, 2026
  4. pack-objects: handle missing promisor objectsAlessio Attilio via GitGitGadget, Nov 25, 2026
  5. Junio C HamanoNov 26, 2026
  6. ATTILIO ALESSIONov 26, 2026
  7. pack-objects: handle missing promisor objectsAlessio Attilio via GitGitGadget, Nov 25, 2026
  8. pack-objects: handle missing promisor objectsAlessio Attilio via GitGitGadget, Nov 25, 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.