From: Jonathan Nieder Date: Thu, 15 May 2014 00:30:31 GMT Subject: Re: [PATCH v6 12/42] replace.c: use the ref transaction functions for updates Message-ID: <20140515003031.GI9218@google.com> In-Reply-To: <1398976662-6962-13-git-send-email-sahlberg@google.com> Ronnie Sahlberg wrote: [...] > +++ b/builtin/replace.c [...] > @@ -157,11 +158,12 @@ static int replace_object(const char *object_ref, const char *replace_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); Same question about the !transaction case. This makes the message translated, which is a nice change but not mentioned in the commit message. (Generally speaking, I don't mind either way about adding or not adding _() to new messages in files that have not already undergone a pass of marking everything for translation.)