git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org, Bill Lear <rael@zopyra.com>
Subject: [PATCH] Catch write_ref_sha1 failure in receive-pack
Date: Wed, 7 Mar 2007 12:04:24 -0500	[thread overview]
Message-ID: <20070307170424.GA27980@spearce.org> (raw)

This failure to catch the failure of write_ref_sha1 was noticed
by Bill Lear.  The ref will not update if the log file could not
be appended to (due to file permissions problems).  Such a failure
should be flagged as a failure to update the ref, so that the client
knows the push did not succeed.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 receive-pack.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/receive-pack.c b/receive-pack.c
index 7f1dcc0..dda9854 100644
--- a/receive-pack.c
+++ b/receive-pack.c
@@ -158,7 +158,10 @@ static int update(struct command *cmd)
 			cmd->error_string = "failed to lock";
 			return error("failed to lock %s", name);
 		}
-		write_ref_sha1(lock, new_sha1, "push");
+		if (write_ref_sha1(lock, new_sha1, "push")) {
+			cmd->error_string = "failed to write";
+			return -1; /* error() already called */
+		}
 		fprintf(stderr, "%s: %s -> %s\n", name, old_hex, new_hex);
 	}
 	return 0;
-- 
1.5.0.3.895.g09890

                 reply	other threads:[~2007-03-07 17:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070307170424.GA27980@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=rael@zopyra.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).