[PATCH 04/10] t1502 (rev-parse --parseopt): test exit code from "-h"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



rev-parse --parseopt exits with code 129 (usage error) when asked
to dump usage with -h on behalf of another command.  Scripts can
take advantage of this to avoid trying to parse usage information
as though it were the regular output from some git command.

Noticed with an &&-chaining tester.

Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
 t/t1502-rev-parse-parseopt.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh
index b3195c4..1efd7f7 100755
--- a/t/t1502-rev-parse-parseopt.sh
+++ b/t/t1502-rev-parse-parseopt.sh
@@ -40,7 +40,7 @@ extra1    line above used to cause a segfault but no longer does
 EOF
 
 test_expect_success 'test --parseopt help output' '
-	git rev-parse --parseopt -- -h > output < optionspec
+	test_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec &&
 	test_cmp expect output
 '
 
-- 
1.7.2.3.557.gab647.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]