3 test_description
='magic pathspec tests using git-log'
7 test_expect_success
'setup' '
10 git commit --allow-empty -m empty &&
14 test_expect_success
'"git log :/" should not be ambiguous' '
18 test_expect_success
'"git log :/a" should be ambiguous (applied both rev and worktree)' '
20 test_must_fail git log :/a 2>error &&
21 test_i18ngrep ambiguous error
24 test_expect_success
'"git log :/a -- " should not be ambiguous' '
28 test_expect_success
'"git log -- :/a" should not be ambiguous' '
32 # This differs from the ":/a" check above in that :/in looks like a pathspec,
33 # but doesn't match an actual file.
34 test_expect_success
'"git log :/in" should not be ambiguous' '
38 test_expect_success
'"git log :" should be ambiguous' '
39 test_must_fail git log : 2>error &&
40 test_i18ngrep ambiguous error
43 test_expect_success
'git log -- :' '
47 test_expect_success
'git log HEAD -- :/' '
48 initial=$(git rev-parse --short HEAD^) &&
49 cat >expected <<-EOF &&
52 (cd sub && git log --oneline HEAD -- :/ >../actual) &&
53 test_cmp expected actual
56 test_expect_success
'"git log :^sub" is not ambiguous' '
60 test_expect_success
'"git log :^does-not-exist" does not match anything' '
61 test_must_fail git log :^does-not-exist
64 test_expect_success
'"git log :!" behaves the same as :^' '
66 test_must_fail git log :!does-not-exist
69 test_expect_success
'"git log :(exclude)sub" is not ambiguous' '
70 git log ":(exclude)sub"
73 test_expect_success
'"git log :(exclude)sub --" must resolve as an object' '
74 test_must_fail git log ":(exclude)sub" --
77 test_expect_success
'"git log :(unknown-magic) complains of bogus magic' '
78 test_must_fail git log ":(unknown-magic)" 2>error &&
79 test_i18ngrep pathspec.magic error
82 test_expect_success
'command line pathspec parsing for "git log"' '
86 git commit -m "add an empty a" --allow-empty &&
88 git commit -a -m "update a to 1" &&
91 git commit -a -m "update a to 2" &&
92 test_must_fail git merge master &&
97 test_expect_success
'tree_entry_interesting does not match past submodule boundaries' '
98 test_when_finished "rm -rf repo submodule" &&
100 test_commit -C submodule initial &&
103 git -C repo add "[bracket]" &&
105 git -C repo commit -m bracket &&
106 git -C repo rev-list HEAD -- "[bracket]" >expect &&
108 git -C repo submodule add ../submodule &&
110 git -C repo commit -m submodule &&
112 git -C repo rev-list HEAD -- "[bracket]" >actual &&
113 test_cmp expect actual