Skip to content

fetch: fix non-conflicting tags not being committed

The commit 0e358de6 (fetch: use batched reference updates, 2025-05-19) updated the 'git-fetch(1)' command to use batched updates. This batches updates to gain performance improvements. When fetching references, each update is added to the transaction. Finally, when committing, individual updates are allowed to fail with reason, while the transaction itself succeeds.

One scenario which was missed here, was fetching tags. When fetching conflicting tags, the fetch_and_consume_refs() function returns '1', which skipped committing the transaction and directly jumped to the cleanup section. This mean that no updates were applied.

Fix this by committing the transaction even when we have an error code. This ensures other references are applied. Do this by extracting out the transaction commit code into a new commit_ref_transaction() function and using that.

Add two tests to check for this regression. While here, add a missing cleanup from previous test.

Closes #616

Edited by Karthik Nayak

Merge request reports

Loading