]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4208-log-magic-pathspec.sh
multi-pack-index: load into memory
[thirdparty/git.git] / t / t4208-log-magic-pathspec.sh
CommitLineData
6fd09f53
NTND
1#!/bin/sh
2
3test_description='magic pathspec tests using git-log'
4
5. ./test-lib.sh
6
7test_expect_success 'setup' '
8 test_commit initial &&
9 test_tick &&
10 git commit --allow-empty -m empty &&
11 mkdir sub
12'
13
4db86e8b
NTND
14test_expect_success '"git log :/" should not be ambiguous' '
15 git log :/
16'
17
18test_expect_success '"git log :/a" should be ambiguous (applied both rev and worktree)' '
19 : >a &&
20 test_must_fail git log :/a 2>error &&
ab33a76e 21 test_i18ngrep ambiguous error
6fd09f53
NTND
22'
23
4db86e8b
NTND
24test_expect_success '"git log :/a -- " should not be ambiguous' '
25 git log :/a --
26'
27
28test_expect_success '"git log -- :/a" should not be ambiguous' '
29 git log -- :/a
30'
31
be6ed3f3
JK
32# This differs from the ":/a" check above in that :/in looks like a pathspec,
33# but doesn't match an actual file.
34test_expect_success '"git log :/in" should not be ambiguous' '
35 git log :/in
36'
37
6fd09f53
NTND
38test_expect_success '"git log :" should be ambiguous' '
39 test_must_fail git log : 2>error &&
ab33a76e 40 test_i18ngrep ambiguous error
6fd09f53
NTND
41'
42
43test_expect_success 'git log -- :' '
44 git log -- :
45'
46
47test_expect_success 'git log HEAD -- :/' '
0b2c4af4 48 initial=$(git rev-parse --short HEAD^) &&
6fd09f53 49 cat >expected <<-EOF &&
0b2c4af4 50 $initial initial
6fd09f53
NTND
51 EOF
52 (cd sub && git log --oneline HEAD -- :/ >../actual) &&
53 test_cmp expected actual
54'
55
42471bce
JK
56test_expect_success '"git log :^sub" is not ambiguous' '
57 git log :^sub
58'
59
60test_expect_success '"git log :^does-not-exist" does not match anything' '
61 test_must_fail git log :^does-not-exist
62'
63
64test_expect_success '"git log :!" behaves the same as :^' '
65 git log :!sub &&
66 test_must_fail git log :!does-not-exist
67'
68
c99eddd8
JK
69test_expect_success '"git log :(exclude)sub" is not ambiguous' '
70 git log ":(exclude)sub"
71'
72
73test_expect_success '"git log :(exclude)sub --" must resolve as an object' '
74 test_must_fail git log ":(exclude)sub" --
75'
76
77test_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
80'
81
c8556c62
NTND
82test_expect_success 'command line pathspec parsing for "git log"' '
83 git reset --hard &&
84 >a &&
85 git add a &&
86 git commit -m "add an empty a" --allow-empty &&
87 echo 1 >a &&
88 git commit -a -m "update a to 1" &&
89 git checkout HEAD^ &&
90 echo 2 >a &&
91 git commit -a -m "update a to 2" &&
92 test_must_fail git merge master &&
93 git add a &&
94 git log --merge -- a
95'
96
eef3df5a
BW
97test_expect_success 'tree_entry_interesting does not match past submodule boundaries' '
98 test_when_finished "rm -rf repo submodule" &&
99 git init submodule &&
100 test_commit -C submodule initial &&
101 git init repo &&
102 >"repo/[bracket]" &&
103 git -C repo add "[bracket]" &&
104 test_tick &&
105 git -C repo commit -m bracket &&
106 git -C repo rev-list HEAD -- "[bracket]" >expect &&
107
108 git -C repo submodule add ../submodule &&
109 test_tick &&
110 git -C repo commit -m submodule &&
111
112 git -C repo rev-list HEAD -- "[bracket]" >actual &&
113 test_cmp expect actual
114'
115
6fd09f53 116test_done