@matheusbsbs / matheus-bagliano / commits / ef203f0856
Fork 0

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>

Shawn O. Pearce committed Mar 7, 2007 at 12:04 UTC ef203f08564c1c6d267fedf8e0357c56d477892f
1 file changed +4 -1
receive-pack.c
+4 -1
@@ -158,7 +158,10 @@ static int update(struct command *cmd)
158 cmd->error_string = "failed to lock";
159 return error("failed to lock %s", name);
160 }
161 - write_ref_sha1(lock, new_sha1, "push");
161 + if (write_ref_sha1(lock, new_sha1, "push")) {
162 + cmd->error_string = "failed to write";
163 + return -1; /* error() already called */
164 + }
165 fprintf(stderr, "%s: %s -> %s\n", name, old_hex, new_hex);
166 }
167 return 0;