summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-03-07 17:04:24 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-03-07 18:01:44 (GMT)
commitef203f08564c1c6d267fedf8e0357c56d477892f (patch)
treecbc2b6f403cab3873b065eff13fb1214996316a1
parent58db64f73c3dedb41467f915b45d305d52d04d2c (diff)
downloadgit-ef203f08564c1c6d267fedf8e0357c56d477892f.zip
git-ef203f08564c1c6d267fedf8e0357c56d477892f.tar.gz
git-ef203f08564c1c6d267fedf8e0357c56d477892f.tar.bz2
Catch write_ref_sha1 failure in receive-pack
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> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--receive-pack.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/receive-pack.c b/receive-pack.c
index 7311c82..ea6872e 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;