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

[PATCH 1/3] t5516: record redundant blobs after rebasing

From
Marc Strapetz via GitGitGadget <gitgitgadget@gmail.com>
Date
Oct 26, 2026, 15:46 UTC
Message-ID
<84157f543eebc2ed347dd2165ed6046305e9226b.1793029565.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.2281.git.1793029565.gitgitgadget@gmail.com>
From: Marc Strapetz <marc.strapetz@syntevo.com>

A forced push of a rebased branch can resend an unchanged blob even though the receiver has it through the advertised old tip.

Add object-count tests for --force, --force-with-lease and forced refspecs. Confirm that the blob is unchanged by the rebase and record the current three-object pack: the rebased commit, its tree and the unchanged blob. Disable push bitmaps to exercise normal enumeration.

Also cover local replacement refs, which must not cause objects missing from the receiver to be omitted.

Assisted-by: GPT-6 Astra, GPT-6.1 Sol
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
---
 t/t5516-fetch-push.sh | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index b982b209bf..a46ba91ba0 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -193,6 +193,49 @@ grep_wrote () {
 	grep 'write_pack_file/wrote.*"value":"'$1'"' $2
 }
 
+for push_args in \
+	"--force origin topic" \
+	"--force-with-lease origin topic" \
+	"origin +topic"
+do
+	test_expect_success "push of rebased branch with $push_args" '
+		mk_test testrepo heads/main &&
+		test_when_finished "rm -rf rebased rebased-push-event" &&
+		git clone testrepo rebased &&
+		(
+			cd rebased &&
+			git checkout -b topic &&
+			test_commit feature &&
+			git push origin topic &&
+			git checkout main &&
+			test_commit upstream path1 &&
+			git push origin main &&
+			git checkout topic &&
+			git rebase main &&
+			test_cmp_rev feature:feature.t HEAD:feature.t &&
+			GIT_TRACE2_EVENT="$D/rebased-push-event" \
+			git -c push.useBitmaps=false push $push_args
+		) &&
+		grep_wrote 3 rebased-push-event # 1 commit, 1 tree, 1 blob
+	'
+done
+
+test_expect_success 'forced update ignores replacement for old tip' '
+	mk_test testrepo heads/main &&
+	test_when_finished "rm -rf replaced" &&
+	git clone testrepo replaced &&
+	(
+		cd replaced &&
+		test_commit old &&
+		git push origin main &&
+		old_tip=$(git rev-parse HEAD) &&
+		git reset --hard HEAD^ &&
+		test_commit new &&
+		git replace "$old_tip" HEAD &&
+		git push --force origin main
+	)
+'
+
 test_expect_success 'push without negotiation' '
 	mk_empty testrepo &&
 	git push testrepo $the_first_commit:refs/remotes/origin/first_commit &&
-- 
gitgitgadget
Previous: Marc Strapetz via GitGitGadgetNext: Marc Strapetz via GitGitGadget
Message 2 of 7 in “send-pack: avoid resending unchanged objects after rebasing”
  1. 0/3 send-pack: avoid resending unchanged objects after rebasingMarc Strapetz via GitGitGadget, Oct 26, 2026
  2. 1/3 t5516: record redundant blobs after rebasingMarc Strapetz via GitGitGadget, Oct 26, 2026
  3. 2/3 pack-objects: inspect selected haves for shared objectsMarc Strapetz via GitGitGadget, Oct 26, 2026
  4. 3/3 send-pack: avoid resending unchanged blobs after rebasingMarc Strapetz via GitGitGadget, Oct 26, 2026
  5. Junio C HamanoOct 26, 2026
  6. Marc StrapetzOct 26, 2026
  7. Marc StrapetzNov 4, 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.