From 003c84f6d2b9e9c4d5bbf5262cae994bac7190cb Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 2 May 2011 13:39:16 -0700 Subject: specifying ranges: we did not mean to make ".." an empty set Either end of revision range operator can be omitted to default to HEAD, as in "origin.." (what did I do since I forked) or "..origin" (what did they do since I forked). But the current parser interprets ".." as an empty range "HEAD..HEAD", and worse yet, because ".." does exist on the filesystem, we get this annoying output: $ cd Documentation/howto $ git log .. ;# give me recent commits that touch Documentation/ area. fatal: ambiguous argument '..': both revision and filename Use '--' to separate filenames from revisions Surely we could say "git log ../" or even "git log -- .." to disambiguate, but we shouldn't have to. Helped-by: Jeff King Signed-off-by: Junio C Hamano --- t/t1506-rev-parse-diagnosis.sh | 14 ++++++++++++++ t/t4202-log.sh | 7 +++++++ 2 files changed, 21 insertions(+) (limited to 't') diff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh index c5cb77a0e..f950c1012 100755 --- a/t/t1506-rev-parse-diagnosis.sh +++ b/t/t1506-rev-parse-diagnosis.sh @@ -182,4 +182,18 @@ test_expect_success ':file correctly diagnosed after a pathname' ' test_cmp expect actual ' +test_expect_success 'dotdot is not an empty set' ' + ( H=$(git rev-parse HEAD) && echo $H && echo ^$H ) >expect && + + git rev-parse HEAD.. >actual && + test_cmp expect actual && + + git rev-parse ..HEAD >actual && + test_cmp expect actual && + + echo .. >expect && + git rev-parse .. >actual && + test_cmp expect actual +' + test_done diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 71be59d44..45058cc8c 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -806,4 +806,11 @@ test_expect_success 'log --graph with diff and stats' ' test_cmp expect actual.sanitized ' +test_expect_success 'dotdot is a parent directory' ' + mkdir -p a/b && + ( echo sixth && echo fifth ) >expect && + ( cd a/b && git log --format=%s .. ) >actual && + test_cmp expect actual +' + test_done -- cgit v1.2.1