path: root/t/
diff options
authorShawn O. Pearce <>2007-03-07 21:51:59 (GMT)
committerJunio C Hamano <>2007-03-07 22:47:09 (GMT)
commit8aaf7d6410119ee221f5d3ebdc4fc5a57f862665 (patch)
treeb8360ef8652b0a9c7d2196ca0eca5c9e125d4c76 /t/
parentc8dd277109c1cdb9422e474e6bd6e32a382291a0 (diff)
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 <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 3 insertions, 3 deletions
diff --git a/t/ b/t/
index 7d93d0d..b1c97b0 100755
--- a/t/
+++ b/t/
@@ -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