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 /t | |
parent | c8dd277109c1cdb9422e474e6bd6e32a382291a0 (diff) | |
download | git-8aaf7d6410119ee221f5d3ebdc4fc5a57f862665.tar.gz |
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 't')
-rwxr-xr-x | t/t5400-send-pack.sh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh index 7d93d0d7c9..b1c97b0dfb 100755 --- a/t/t5400-send-pack.sh +++ b/t/t5400-send-pack.sh @@ -108,9 +108,9 @@ test_expect_success \ cd victim && git-config receive.denyNonFastforwards true && cd .. && - git-update-ref refs/heads/master master^ && - git-send-pack --force ./victim/.git/ master && - ! diff -u .git/refs/heads/master victim/.git/refs/heads/master + git-update-ref refs/heads/master master^ || return 1 + git-send-pack --force ./victim/.git/ master && return 1 + ! diff .git/refs/heads/master victim/.git/refs/heads/master ' test_done |