Subject: Re: [PATCH 12/14] hold_lock_file_for_update: pass error message back through a strbuf

From: Jonathan Nieder <[email-masked]>
Date: Wed, 3 Dec 2014 10:53:03 -0800

Jonathan Nieder wrote:

> --- a/credential-store.c
> +++ b/credential-store.c
> @@ -55,13 +55,17 @@ static void print_line(struct strbuf *buf)
>  static void rewrite_credential_file(const char *fn, struct credential *c,
>  				    struct strbuf *extra)
>  {
> -	hold_lock_file_for_update(&credential_lock, fn,
> -				  LOCK_DIE_ON_ERROR | LOCK_OUTSIDE_REPOSITORY);
> +	struct strbuf err = STRBUF_INIT;
> +
> +	if (hold_lock_file_for_update(&credential_lock, fn,
> +				      LOCK_OUTSIDE_REPOSITORY, &err) < 0);
> +		die("%s", err.buf);

I forgot to squash this in.  Sorry for the confusion.  (I'm planning to
reroll with this and the commit clarification tboegi mentioned --- other
comments welcome before then.)

-- >8 --
Subject: fixup! hold_lock_file_for_update: pass error message back through a strbuf

Signed-off-by: Jonathan Nieder <[email-masked]>
---
 credential-store.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/credential-store.c b/credential-store.c
index beffa87..2d5d92f 100644
--- a/credential-store.c
+++ b/credential-store.c
@@ -58,7 +58,7 @@ static void rewrite_credential_file(const char *fn, struct credential *c,
 	struct strbuf err = STRBUF_INIT;
 
 	if (hold_lock_file_for_update(&credential_lock, fn,
-				      LOCK_OUTSIDE_REPOSITORY, &err) < 0);
+				      LOCK_OUTSIDE_REPOSITORY, &err) < 0)
 		die("%s", err.buf);
 	if (extra)
 		print_line(extra);