summaryrefslogtreecommitdiff
path: root/t/t4202-log.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2019-08-06 14:40:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-08-06 20:05:39 (GMT)
commit51b4594b4024d5cb2b4ace36ff932affa31c03f4 (patch)
tree9e08e5a9e57b4c78d14f378e72e3e170c6f099b0 /t/t4202-log.sh
parent19e8789b236dfe33667747d5523d6689bb59b5ef (diff)
downloadgit-51b4594b4024d5cb2b4ace36ff932affa31c03f4.zip
git-51b4594b4024d5cb2b4ace36ff932affa31c03f4.tar.gz
git-51b4594b4024d5cb2b4ace36ff932affa31c03f4.tar.bz2
parse-options: allow --end-of-options as a synonym for "--"
The revision option parser recently learned about --end-of-options, but that's not quite enough for all callers. Some of them, like git-log, pick out some options using parse_options(), and then feed the remainder to setup_revisions(). For those cases we need to stop parse_options() from finding more options when it sees --end-of-options, and to retain that option in argv so that setup_revisions() can see it as well. Let's handle this the same as we do "--". We can even piggy-back on the handling of PARSE_OPT_KEEP_DASHDASH, because any caller that wants to retain one will want to retain the other. I've included two tests here. The "log" test covers "--source", which is one of the options it handles with parse_options(), and would fail before this patch. There's also a test that uses the parse-options helper directly. That confirms that the option is handled correctly even in cases without KEEP_DASHDASH or setup_revisions(). I.e., it is safe to use --end-of-options in place of "--" in other programs. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4202-log.sh')
-rwxr-xr-xt/t4202-log.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index c202093..e88ccb0 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -1707,4 +1707,11 @@ test_expect_success '--exclude-promisor-objects does not BUG-crash' '
test_must_fail git log --exclude-promisor-objects source-a
'
+test_expect_success 'log --end-of-options' '
+ git update-ref refs/heads/--source HEAD &&
+ git log --end-of-options --source >actual &&
+ git log >expect &&
+ test_cmp expect actual
+'
+
test_done