]> git.ipfire.org Git - thirdparty/git.git/commit
receive-pack: handle reference deletions separately
authorKarthik Nayak <karthik.188@gmail.com>
Fri, 20 Jun 2025 07:15:45 +0000 (09:15 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Jun 2025 15:20:27 +0000 (08:20 -0700)
commit5c697f0b7ddbc85965bcba00c29d4b823bd221b7
tree05d1fa238b4ce9fd3e67bcbde2afb49801aa5b4f
parent15c45c745872af43df08c60979476520165a1df1
receive-pack: handle reference deletions separately

In 9d2962a7c4 (receive-pack: use batched reference updates, 2025-05-19)
we updated the 'git-receive-pack(1)' command to use batched reference
updates. One edge case which was missed during this implementation was
when a user pushes multiple branches such as:

  delete refs/heads/branch/conflict
  create refs/heads/branch

Before using batched updates, the references would be applied
sequentially and hence no conflicts would arise. With batched updates,
while the first update applies, the second fails due to D/F conflict. A
similar issue was present in 'git-fetch(1)' and was fixed by separating
out reference pruning into a separate transaction in the commit 'fetch:
use batched reference updates'. Apply a similar mechanism for
'git-receive-pack(1)' and separate out reference deletions into its own
batch.

This means 'git-receive-pack(1)' will now use up to two transactions,
whereas before using batched updates it would use _at least_ two
transactions. So using batched updates is still the better option.

Add a test to validate this behavior.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/receive-pack.c
t/t5516-fetch-push.sh