clean: replace match_pathspec() with dir_path_match()
[gitweb.git] / t / t4211-line-log.sh
index 7665d6785c1a91ed0171e8cac61174ebee9b9a37..7369d3c517294feda894eba85f7b02ac9a57ccae 100755 (executable)
@@ -48,7 +48,7 @@ canned_test "-M -L '/long f/,/^}/:b.c' move-support" move-support-f
 canned_test "-M -L ':f:b.c' parallel-change" parallel-change-f-to-main
 
 canned_test "-L 4,12:a.c -L :main:a.c simple" multiple
-canned_test "-L 4,18:a.c -L :main:a.c simple" multiple-overlapping
+canned_test "-L 4,18:a.c -L ^:main:a.c simple" multiple-overlapping
 canned_test "-L :main:a.c -L 4,18:a.c simple" multiple-overlapping
 canned_test "-L 4:a.c -L 8,12:a.c simple" multiple-superset
 canned_test "-L 8,12:a.c -L 4:a.c simple" multiple-superset
@@ -64,17 +64,34 @@ test_bad_opts "-L 1,1000:b.c" "has only.*lines"
 test_bad_opts "-L :b.c" "argument.*not of the form"
 test_bad_opts "-L :foo:b.c" "no match"
 
-# There is a separate bug when an empty -L range is the first -L encountered,
-# thus to demonstrate this particular bug, the empty -L range must follow a
-# non-empty -L range.
-test_expect_success '-L {empty-range} (any -L)' '
+test_expect_success '-L X (X == nlines)' '
+       n=$(wc -l <b.c) &&
+       git log -L $n:b.c
+'
+
+test_expect_success '-L X (X == nlines + 1)' '
        n=$(expr $(wc -l <b.c) + 1) &&
-       git log -L1,1:b.c -L$n:b.c
+       test_must_fail git log -L $n:b.c
+'
+
+test_expect_success '-L X (X == nlines + 2)' '
+       n=$(expr $(wc -l <b.c) + 2) &&
+       test_must_fail git log -L $n:b.c
 '
 
-test_expect_success '-L {empty-range} (first -L)' '
+test_expect_success '-L ,Y (Y == nlines)' '
+       n=$(printf "%d" $(wc -l <b.c)) &&
+       git log -L ,$n:b.c
+'
+
+test_expect_success '-L ,Y (Y == nlines + 1)' '
        n=$(expr $(wc -l <b.c) + 1) &&
-       git log -L$n:b.c
+       test_must_fail git log -L ,$n:b.c
+'
+
+test_expect_success '-L ,Y (Y == nlines + 2)' '
+       n=$(expr $(wc -l <b.c) + 2) &&
+       test_must_fail git log -L ,$n:b.c
 '
 
 test_done