Skip to content

Commit

Permalink
Catch write_ref_sha1 failure in receive-pack
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shawn O. Pearce authored and Junio C Hamano committed Mar 7, 2007
1 parent 58db64f commit ef203f0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion receive-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ef203f0

Please sign in to comment.