Ronnie Sahlberg wrote:

> --- a/builtin/replace.c
> +++ b/builtin/replace.c
[...]
> @@ -156,11 +157,12 @@ static int replace_object_sha1(const char *object_ref,
>       else if (!force)
>               die("replace ref '%s' already exists", ref);
>  
> -     lock = lock_any_ref_for_update(ref, prev, 0, NULL);
> -     if (!lock)
> -             die("%s: cannot lock the ref", ref);
> -     if (write_ref_sha1(lock, repl, NULL) < 0)
> -             die("%s: cannot update the ref", ref);
> +     transaction = ref_transaction_begin();
> +     if (!transaction ||
> +         ref_transaction_update(transaction, ref, repl, prev,
> +                                0, !is_null_sha1(prev)) ||
> +         ref_transaction_commit(transaction, NULL, &err))
> +             die("%s: failed to replace ref: %s", ref, err.buf);

This would write

        fatal: refs/replace/09c779943364d893c190066c385e6112af421db3: failed to 
replace ref: Cannot lock the ref 
'refs/replace/09c779943364d893c190066c385e6112af421db3'.

Perhaps something like

        $ git replace foo bar
        fatal: replace foo: Cannot lock the ref 
'refs/replace/09c779943364d893c190066c385e6112af421db3'.

would make sense (die("replace %s: %s", object_ref, err.buf)).  Plain

        $ git replace foo bar
        fatal: Cannot lock the ref 
'refs/replace/09c779943364d893c190066c385e6112af421db3'.

also seems fine (die("%s", err.buf)).

Thanks,
Jonathan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to