test: remove httpd tests that ask for user
[git] / t / t1508-at-combinations.sh
1 #!/bin/sh
2
3 test_description='test various @{X} syntax combinations together'
4 . ./test-lib.sh
5
6 check() {
7         test_expect_${4:-success} "$1 = $3" "
8                 echo '$3' >expect &&
9                 if test '$2' = 'commit'
10                 then
11                         git log -1 --format=%s '$1' >actual
12                 elif test '$2' = 'ref'
13                 then
14                         git rev-parse --symbolic-full-name '$1' >actual
15                 else
16                         git cat-file -p '$1' >actual
17                 fi &&
18                 test_cmp expect actual
19         "
20 }
21
22 nonsense() {
23         test_expect_${2:-success} "$1 is nonsensical" "
24                 test_must_fail git rev-parse --verify '$1'
25         "
26 }
27
28 fail() {
29         "$@" failure
30 }
31
32 test_expect_success 'setup' '
33         test_commit master-one &&
34         test_commit master-two &&
35         git checkout -b publish-branch &&
36         git checkout -b upstream-branch &&
37         test_commit upstream-one &&
38         test_commit upstream-two &&
39         if test_have_prereq !MINGW
40         then
41                 git checkout -b @/at-test
42         fi &&
43         git checkout -b @@/at-test &&
44         git checkout -b @at-test &&
45         git checkout -b old-branch &&
46         test_commit old-one &&
47         test_commit old-two &&
48         git checkout -b new-branch &&
49         test_commit new-one &&
50         test_commit new-two &&
51         git branch -u master old-branch &&
52         git branch -u upstream-branch new-branch &&
53         git branch -p publish-branch new-branch
54 '
55
56 check HEAD ref refs/heads/new-branch
57 check "@{1}" commit new-one
58 check "HEAD@{1}" commit new-one
59 check "@{now}" commit new-two
60 check "HEAD@{now}" commit new-two
61 check "@{-1}" ref refs/heads/old-branch
62 check "@{-1}@{0}" commit old-two
63 check "@{-1}@{1}" commit old-one
64 check "@{u}" ref refs/heads/upstream-branch
65 check "HEAD@{u}" ref refs/heads/upstream-branch
66 check "@{u}@{1}" commit upstream-one
67 check "@{-1}@{u}" ref refs/heads/master
68 check "@{-1}@{u}@{1}" commit master-one
69 check "@{p}" ref refs/heads/publish-branch
70 check "HEAD@{p}" ref refs/heads/publish-branch
71 check "@" commit new-two
72 check "@@{u}" ref refs/heads/upstream-branch
73 check "@@{p}" ref refs/heads/publish-branch
74 check "@@/at-test" ref refs/heads/@@/at-test
75 test_have_prereq MINGW ||
76 check "@/at-test" ref refs/heads/@/at-test
77 check "@at-test" ref refs/heads/@at-test
78 nonsense "@{u}@{-1}"
79 nonsense "@{0}@{0}"
80 nonsense "@{1}@{u}"
81 nonsense "HEAD@{-1}"
82 nonsense "@{-1}@{-1}"
83
84 # @{N} versus HEAD@{N}
85
86 check "HEAD@{3}" commit old-two
87 nonsense "@{3}"
88
89 test_expect_success 'switch to old-branch' '
90         git checkout old-branch
91 '
92
93 check HEAD ref refs/heads/old-branch
94 check "HEAD@{1}" commit new-two
95 check "@{1}" commit old-one
96
97 test_expect_success 'create path with @' '
98         echo content >normal &&
99         echo content >fun@ny &&
100         git add normal fun@ny &&
101         git commit -m "funny path"
102 '
103
104 check "@:normal" blob content
105 check "@:fun@ny" blob content
106
107 test_done