3 test_description='test log -L'
6 test_expect_success 'setup (import history)' '
7 git fast-import < "$TEST_DIRECTORY"/t4211/history.export &&
12 test_expect_success "$1" "
14 test_cmp \"\$TEST_DIRECTORY\"/t4211/expect.$2 actual
19 test_expect_success "invalid args: $1" "
20 test_must_fail git log $1 2>errors &&
25 canned_test "-L 4,12:a.c simple" simple-f
26 canned_test "-L 4,+9:a.c simple" simple-f
27 canned_test "-L '/long f/,/^}/:a.c' simple" simple-f
28 canned_test "-L :f:a.c simple" simple-f-to-main
30 canned_test "-L '/main/,/^}/:a.c' simple" simple-main
31 canned_test "-L :main:a.c simple" simple-main-to-end
33 canned_test "-L 1,+4:a.c simple" beginning-of-file
35 canned_test "-L 20:a.c simple" end-of-file
37 canned_test "-L '/long f/',/^}/:a.c -L /main/,/^}/:a.c simple" two-ranges
38 canned_test "-L 24,+1:a.c simple" vanishes-early
40 canned_test "-L '/long f/,/^}/:b.c' move-support" move-support-f
42 canned_test "-L 4,12:a.c -L :main:a.c simple" multiple
43 canned_test "-L 4,18:a.c -L :main:a.c simple" multiple-overlapping
44 canned_test "-L :main:a.c -L 4,18:a.c simple" multiple-overlapping
45 canned_test "-L 4:a.c -L 8,12:a.c simple" multiple-superset
46 canned_test "-L 8,12:a.c -L 4:a.c simple" multiple-superset
48 test_bad_opts "-L" "switch.*requires a value"
49 test_bad_opts "-L b.c" "argument.*not of the form"
50 test_bad_opts "-L 1:" "argument.*not of the form"
51 test_bad_opts "-L 1:nonexistent" "There is no path"
52 test_bad_opts "-L 1:simple" "There is no path"
53 test_bad_opts "-L '/foo:b.c'" "argument.*not of the form"
54 test_bad_opts "-L 1000:b.c" "has only.*lines"
55 test_bad_opts "-L 1,1000:b.c" "has only.*lines"
56 test_bad_opts "-L :b.c" "argument.*not of the form"
57 test_bad_opts "-L :foo:b.c" "no match"