]> git.ipfire.org Git - thirdparty/git.git/commit
update-ref: add --batch-updates flag for stdin mode
authorKarthik Nayak <karthik.188@gmail.com>
Tue, 8 Apr 2025 08:51:12 +0000 (10:51 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 8 Apr 2025 14:59:49 +0000 (07:59 -0700)
commit221e8fcb7f543f056246a901bcb1269a13145fa9
treeb41af0e7c0ea7578e05c3d222a0da5cac88fa917
parent31726bb90d70236f7afaa345bf45195e2ef62d22
update-ref: add --batch-updates flag for stdin mode

When updating multiple references through stdin, Git's update-ref
command normally aborts the entire transaction if any single update
fails. This atomic behavior prevents partial updates. Introduce a new
batch update system, where the updates the performed together similar
but individual updates are allowed to fail.

Add a new `--batch-updates` flag that allows the transaction to continue
even when individual reference updates fail. This flag can only be used
in `--stdin` mode and builds upon the batch update support added to the
refs subsystem in the previous commits. When enabled, failed updates are
reported in the following format:

  rejected SP (<old-oid> | <old-target>) SP (<new-oid> | <new-target>) SP <rejection-reason> LF

Update the documentation to reflect this change and also tests to cover
different scenarios where an update could be rejected.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-update-ref.adoc
builtin/update-ref.c
t/t1400-update-ref.sh