From: "Marc Strapetz via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Marc Strapetz <marc.strapetz@syntevo.com>,
Marc Strapetz <marc.strapetz@syntevo.com>
Subject: [PATCH 1/3] t5516: record redundant blobs after rebasing
Date: Mon, 26 Oct 2026 15:46:03 +0000 [thread overview]
Message-ID: <84157f543eebc2ed347dd2165ed6046305e9226b.1793029565.git.gitgitgadget@gmail.com> (raw)
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
next prev parent reply other threads:[~2026-10-26 15:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 15:46 [PATCH 0/3] send-pack: avoid resending unchanged objects after rebasing Marc Strapetz via GitGitGadget
2026-10-26 15:46 ` Marc Strapetz via GitGitGadget [this message]
2026-10-26 15:46 ` [PATCH 2/3] pack-objects: inspect selected haves for shared objects Marc Strapetz via GitGitGadget
2026-10-26 15:46 ` [PATCH 3/3] send-pack: avoid resending unchanged blobs after rebasing Marc Strapetz via GitGitGadget
2026-10-26 17:26 ` [PATCH 0/3] send-pack: avoid resending unchanged objects " Junio C Hamano
2026-10-26 21:23 ` Marc Strapetz
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=84157f543eebc2ed347dd2165ed6046305e9226b.1793029565.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=marc.strapetz@syntevo.com \
/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