Subject: Re: [PATCH v5 8/8] update-ref: add --batch-updates flag for stdin mode

From: Jean-Noël AVILA <[email-masked]>
Date: Fri, 28 Mar 2025 14:00:49 +0100

On Thursday, 27 March 2025 12:13:32 CET Karthik Nayak wrote:
> 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 <[email-masked]>
> ---
>  Documentation/git-update-ref.adoc |  14 ++-
>  builtin/update-ref.c              |  66 ++++++++++-
>  t/t1400-update-ref.sh             | 233
> ++++++++++++++++++++++++++++++++++++++ 3 files changed, 306 insertions(+), 7
> deletions(-)
> 
> diff --git a/Documentation/git-update-ref.adoc
> b/Documentation/git-update-ref.adoc index 9e6935d38d..5be2c16776 100644
> --- a/Documentation/git-update-ref.adoc
> +++ b/Documentation/git-update-ref.adoc
> @@ -7,8 +7,10 @@ git-update-ref - Update the object name stored in a ref
> safely
> 
>  SYNOPSIS
>  --------
> -[verse]
> -'git update-ref' [-m <reason>] [--no-deref] (-d <ref> [<old-oid>] |
> [--create-reflog] <ref> <new-oid> [<old-oid>] | --stdin [-z]) +[synopsis]
> +git update-ref [-m <reason>] [--no-deref] -d <ref> [<old-oid>]
> +	       [-m <reason>] [--no-deref] [--create-reflog] <ref> <new-oid>
> [<old-oid>] +               [-m <reason>] [--no-deref] --stdin [-z]
> [--batch-updates]

In the case of expressing alternative command line invocations, you need to 
repeat the "git update-ref" command on each line. Otherwise, it means that 
this is the continuation of possible options of one command

>  DESCRIPTION
>  -----------