diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2007-03-07 16:51:59 -0500 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-03-07 14:47:09 -0800 |
commit | 8aaf7d6410119ee221f5d3ebdc4fc5a57f862665 (patch) | |
tree | b8360ef8652b0a9c7d2196ca0eca5c9e125d4c76 /entry.c | |
parent | Refactor run_update_hook to be more useful (diff) | |
download | tgif-8aaf7d6410119ee221f5d3ebdc4fc5a57f862665.tar.xz |
Refactor handling of error_string in receive-pack
I discovered we did not send an ng line in the report-status feedback
if the ref was not updated because the repository has the config
option receive.denyNonFastForwards enabled. I think the reason this
happened is that it is simply too easy to forget to set error_string
when returning back a failure from update()
We now return an ng line for a non-fastforward update, which in
turn will cause send-pack to exit with a non-zero exit status.
Hence the modified test.
This refactoring changes update to return a const char* describing
the error, which execute_commands always loads into error_string.
The result is what I think is cleaner code, and allows us to
initialize the error_string member to NULL when we read_head_info.
I want error_string to be NULL in all commands before we call
execute_commands, so that we can reuse the run_hook function to
execute a new pre-receive hook.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'entry.c')
0 files changed, 0 insertions, 0 deletions