From: Marc Strapetz via GitGitGadget Date: Mon, 26 Oct 2026 15:46:03 GMT Subject: [PATCH 1/3] t5516: record redundant blobs after rebasing Message-ID: <84157f543eebc2ed347dd2165ed6046305e9226b.1793029565.git.gitgitgadget@gmail.com> In-Reply-To: From: Marc Strapetz 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 --- 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