Re: [PATCH v5 2/7] files-backend: extract out `create_symref_lock()`
- From
Patrick Steinhardt <ps@pks.im>
- Date
- May 2, 2024, 07:47 UTC
- Message-ID
- <ZjNFBZOlcQNVYm8O@tanuki>
- In-Reply-To
- <xmqq7cgdjig4.fsf@gitster.g>
On Wed, May 01, 2024 at 03:06:19PM -0700, Junio C Hamano wrote:
Show 16 quoted lines
> Karthik Nayak <karthik.188@gmail.com> writes:
>
> > + if (!fdopen_lock_file(&lock->lk, "w"))
> > + return error("unable to fdopen %s: %s",
> > + get_lock_file_path(&lock->lk), strerror(errno));
> > +
> > + if (fprintf(get_lock_file_fp(&lock->lk), "ref: %s\n", target) < 0)
> > + return error("unable to fprintf %s: %s",
> > + get_lock_file_path(&lock->lk), strerror(errno));
>
> error() is end-user facing, so "fprintf" is probably a bit too
> precise? "fprintf" -> "write to"
>
> Also we may want to make them (not just this new message but other
> error() messages in related code paths) localizable but that is
> probably beyond the scope of this topic.It only occurred to me now, but shouldn't we also support passing in a `struct strbuf *err` here? The transactional code doesn't want us to print error messages to `stderr`, but always supplies a buffer.
Patrick