]> git.ipfire.org Git - thirdparty/git.git/commit
update-ref: handle rejections while adding updates
authorKarthik Nayak <karthik.188@gmail.com>
Mon, 4 May 2026 17:44:10 +0000 (19:44 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 5 May 2026 07:34:08 +0000 (16:34 +0900)
commite31a10418a4c2270651bab326f4715892db9c3ee
tree03bc72b8dff84e0c55b28680ca3a30e704a7daf3
parent637989cdec77b95fb0743cf433873253cec5ae0f
update-ref: handle rejections while adding updates

When using git-update-ref(1) with the '--batch-updates' flag, updates
rejected by the reference backend are displayed to the user while other
updates are applied. This only applies during the commit phase of the
transaction.

In the following commits, we'll also extend `ref_transaction_update()`
to reject updates before a transaction is prepared/committed. In
preparation, modify the code in update-ref to also handle non-generic
rejections from `ref_transaction_update()`. This involves propagating
information to each of the commands on whether updates are allowed to be
rejected, and also checking for rejections and only dying for generic
failures.

Errors encountered during updates will be shown to the user immediately
unlike other errors encountered only when the transaction is
prepared/committed. As the verification of object IDs and peeled tag
objects will move into `ref_transaction_update()` in the following
commit, this means that those errors will be shown to the user before
other errors, this changes the order of errors, but the functionality
remains the same.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/update-ref.c