t4208: add check for ":/" without matching file
authorJeff King <peff@peff.net>
Fri, 26 May 2017 19:06:41 +0000 (15:06 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 29 May 2017 02:36:53 +0000 (11:36 +0900)
The DWIM magic in check_filename() doesn't just recognize
":/". It actually makes sure that the file it points to
exists. t4208 checks only the case where the path is
present, not the opposite. Since the next patches will be
touching this area, let's add a test to make sure it
continues working.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t4208-log-magic-pathspec.sh
index 001343e2fc2722506172e702266f5bab6278d1e8..70bc64100b707c8e2d2c7913ff04e6599de64d18 100755 (executable)
@@ -29,6 +29,12 @@ test_expect_success '"git log -- :/a" should not be ambiguous' '
        git log -- :/a
 '
 
+# This differs from the ":/a" check above in that :/in looks like a pathspec,
+# but doesn't match an actual file.
+test_expect_success '"git log :/in" should not be ambiguous' '
+       git log :/in
+'
+
 test_expect_success '"git log :" should be ambiguous' '
        test_must_fail git log : 2>error &&
        test_i18ngrep ambiguous error