Johannes Schindelin | 28fb843 | 2009-09-10 17:25:57 +0200 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='test <branch>@{upstream} syntax' |
| 4 | |
Johannes Schindelin | 06d5314 | 2020-11-18 23:44:21 +0000 | [diff] [blame] | 5 | GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main |
Johannes Schindelin | 334afbc | 2020-11-18 23:44:19 +0000 | [diff] [blame] | 6 | export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME |
| 7 | |
Johannes Schindelin | 28fb843 | 2009-09-10 17:25:57 +0200 | [diff] [blame] | 8 | . ./test-lib.sh |
| 9 | |
| 10 | |
| 11 | test_expect_success 'setup' ' |
| 12 | |
| 13 | test_commit 1 && |
| 14 | git checkout -b side && |
| 15 | test_commit 2 && |
Johannes Schindelin | 06d5314 | 2020-11-18 23:44:21 +0000 | [diff] [blame] | 16 | git checkout main && |
Johannes Schindelin | 28fb843 | 2009-09-10 17:25:57 +0200 | [diff] [blame] | 17 | git clone . clone && |
| 18 | test_commit 3 && |
| 19 | (cd clone && |
| 20 | test_commit 4 && |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 21 | git branch --track my-side origin/side && |
Johannes Schindelin | 06d5314 | 2020-11-18 23:44:21 +0000 | [diff] [blame] | 22 | git branch --track local-main main && |
Jeff King | 9892d5d | 2014-01-15 03:40:46 -0500 | [diff] [blame] | 23 | git branch --track fun@ny origin/side && |
| 24 | git branch --track @funny origin/side && |
| 25 | git branch --track funny@ origin/side && |
Johannes Schindelin | 06d5314 | 2020-11-18 23:44:21 +0000 | [diff] [blame] | 26 | git remote add -t main main-only .. && |
| 27 | git fetch main-only && |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 28 | git branch bad-upstream && |
Johannes Schindelin | 06d5314 | 2020-11-18 23:44:21 +0000 | [diff] [blame] | 29 | git config branch.bad-upstream.remote main-only && |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 30 | git config branch.bad-upstream.merge refs/heads/side |
| 31 | ) |
Johannes Schindelin | 28fb843 | 2009-09-10 17:25:57 +0200 | [diff] [blame] | 32 | ' |
| 33 | |
Johannes Schindelin | 28fb843 | 2009-09-10 17:25:57 +0200 | [diff] [blame] | 34 | commit_subject () { |
| 35 | (cd clone && |
Denton Liu | 5236fce | 2019-12-20 10:16:00 -0800 | [diff] [blame] | 36 | git show -s --pretty=tformat:%s "$@") |
Johannes Schindelin | 28fb843 | 2009-09-10 17:25:57 +0200 | [diff] [blame] | 37 | } |
| 38 | |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 39 | error_message () { |
| 40 | (cd clone && |
SZEDER Gábor | c3a4456 | 2018-02-24 00:39:43 +0100 | [diff] [blame] | 41 | test_must_fail git rev-parse --verify "$@" 2>../error) |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 42 | } |
| 43 | |
Johannes Schindelin | 28fb843 | 2009-09-10 17:25:57 +0200 | [diff] [blame] | 44 | test_expect_success '@{upstream} resolves to correct full name' ' |
Johannes Schindelin | 06d5314 | 2020-11-18 23:44:21 +0000 | [diff] [blame] | 45 | echo refs/remotes/origin/main >expect && |
Denton Liu | b441717 | 2019-12-20 10:16:02 -0800 | [diff] [blame] | 46 | git -C clone rev-parse --symbolic-full-name @{upstream} >actual && |
Denton Liu | 5236fce | 2019-12-20 10:16:00 -0800 | [diff] [blame] | 47 | test_cmp expect actual && |
Denton Liu | b441717 | 2019-12-20 10:16:02 -0800 | [diff] [blame] | 48 | git -C clone rev-parse --symbolic-full-name @{UPSTREAM} >actual && |
Denton Liu | 5236fce | 2019-12-20 10:16:00 -0800 | [diff] [blame] | 49 | test_cmp expect actual && |
Denton Liu | b441717 | 2019-12-20 10:16:02 -0800 | [diff] [blame] | 50 | git -C clone rev-parse --symbolic-full-name @{UpSTReam} >actual && |
Denton Liu | 5236fce | 2019-12-20 10:16:00 -0800 | [diff] [blame] | 51 | test_cmp expect actual |
Johannes Schindelin | 28fb843 | 2009-09-10 17:25:57 +0200 | [diff] [blame] | 52 | ' |
| 53 | |
| 54 | test_expect_success '@{u} resolves to correct full name' ' |
Johannes Schindelin | 06d5314 | 2020-11-18 23:44:21 +0000 | [diff] [blame] | 55 | echo refs/remotes/origin/main >expect && |
Denton Liu | b441717 | 2019-12-20 10:16:02 -0800 | [diff] [blame] | 56 | git -C clone rev-parse --symbolic-full-name @{u} >actual && |
Denton Liu | 5236fce | 2019-12-20 10:16:00 -0800 | [diff] [blame] | 57 | test_cmp expect actual && |
Denton Liu | b441717 | 2019-12-20 10:16:02 -0800 | [diff] [blame] | 58 | git -C clone rev-parse --symbolic-full-name @{U} >actual && |
Denton Liu | 5236fce | 2019-12-20 10:16:00 -0800 | [diff] [blame] | 59 | test_cmp expect actual |
Johannes Schindelin | 28fb843 | 2009-09-10 17:25:57 +0200 | [diff] [blame] | 60 | ' |
| 61 | |
| 62 | test_expect_success 'my-side@{upstream} resolves to correct full name' ' |
Denton Liu | 5236fce | 2019-12-20 10:16:00 -0800 | [diff] [blame] | 63 | echo refs/remotes/origin/side >expect && |
Denton Liu | b441717 | 2019-12-20 10:16:02 -0800 | [diff] [blame] | 64 | git -C clone rev-parse --symbolic-full-name my-side@{u} >actual && |
Denton Liu | 5236fce | 2019-12-20 10:16:00 -0800 | [diff] [blame] | 65 | test_cmp expect actual |
Johannes Schindelin | 28fb843 | 2009-09-10 17:25:57 +0200 | [diff] [blame] | 66 | ' |
| 67 | |
Jeff King | 9892d5d | 2014-01-15 03:40:46 -0500 | [diff] [blame] | 68 | test_expect_success 'upstream of branch with @ in middle' ' |
Denton Liu | b441717 | 2019-12-20 10:16:02 -0800 | [diff] [blame] | 69 | git -C clone rev-parse --symbolic-full-name fun@ny@{u} >actual && |
Jeff King | 9892d5d | 2014-01-15 03:40:46 -0500 | [diff] [blame] | 70 | echo refs/remotes/origin/side >expect && |
Ævar Arnfjörð Bjarmason | 244ea1b | 2017-03-27 11:16:55 +0000 | [diff] [blame] | 71 | test_cmp expect actual && |
Denton Liu | b441717 | 2019-12-20 10:16:02 -0800 | [diff] [blame] | 72 | git -C clone rev-parse --symbolic-full-name fun@ny@{U} >actual && |
Jeff King | 9892d5d | 2014-01-15 03:40:46 -0500 | [diff] [blame] | 73 | test_cmp expect actual |
| 74 | ' |
| 75 | |
| 76 | test_expect_success 'upstream of branch with @ at start' ' |
Denton Liu | b441717 | 2019-12-20 10:16:02 -0800 | [diff] [blame] | 77 | git -C clone rev-parse --symbolic-full-name @funny@{u} >actual && |
Jeff King | 9892d5d | 2014-01-15 03:40:46 -0500 | [diff] [blame] | 78 | echo refs/remotes/origin/side >expect && |
| 79 | test_cmp expect actual |
| 80 | ' |
| 81 | |
| 82 | test_expect_success 'upstream of branch with @ at end' ' |
Denton Liu | b441717 | 2019-12-20 10:16:02 -0800 | [diff] [blame] | 83 | git -C clone rev-parse --symbolic-full-name funny@@{u} >actual && |
Jeff King | 9892d5d | 2014-01-15 03:40:46 -0500 | [diff] [blame] | 84 | echo refs/remotes/origin/side >expect && |
| 85 | test_cmp expect actual |
| 86 | ' |
| 87 | |
Kacper Kornet | 617cf93 | 2013-03-17 23:17:09 +0100 | [diff] [blame] | 88 | test_expect_success 'refs/heads/my-side@{upstream} does not resolve to my-side{upstream}' ' |
Denton Liu | b441717 | 2019-12-20 10:16:02 -0800 | [diff] [blame] | 89 | test_must_fail git -C clone rev-parse --symbolic-full-name refs/heads/my-side@{upstream} |
Kacper Kornet | 617cf93 | 2013-03-17 23:17:09 +0100 | [diff] [blame] | 90 | ' |
| 91 | |
Johannes Schindelin | 28fb843 | 2009-09-10 17:25:57 +0200 | [diff] [blame] | 92 | test_expect_success 'my-side@{u} resolves to correct commit' ' |
| 93 | git checkout side && |
| 94 | test_commit 5 && |
| 95 | (cd clone && git fetch) && |
Denton Liu | 5236fce | 2019-12-20 10:16:00 -0800 | [diff] [blame] | 96 | echo 2 >expect && |
| 97 | commit_subject my-side >actual && |
| 98 | test_cmp expect actual && |
| 99 | echo 5 >expect && |
| 100 | commit_subject my-side@{u} >actual |
Johannes Schindelin | 28fb843 | 2009-09-10 17:25:57 +0200 | [diff] [blame] | 101 | ' |
| 102 | |
| 103 | test_expect_success 'not-tracking@{u} fails' ' |
Denton Liu | b441717 | 2019-12-20 10:16:02 -0800 | [diff] [blame] | 104 | test_must_fail git -C clone rev-parse --symbolic-full-name non-tracking@{u} && |
Johannes Schindelin | 28fb843 | 2009-09-10 17:25:57 +0200 | [diff] [blame] | 105 | (cd clone && git checkout --no-track -b non-tracking) && |
Denton Liu | b441717 | 2019-12-20 10:16:02 -0800 | [diff] [blame] | 106 | test_must_fail git -C clone rev-parse --symbolic-full-name non-tracking@{u} |
Johannes Schindelin | 28fb843 | 2009-09-10 17:25:57 +0200 | [diff] [blame] | 107 | ' |
| 108 | |
| 109 | test_expect_success '<branch>@{u}@{1} resolves correctly' ' |
| 110 | test_commit 6 && |
| 111 | (cd clone && git fetch) && |
Denton Liu | 5236fce | 2019-12-20 10:16:00 -0800 | [diff] [blame] | 112 | echo 5 >expect && |
| 113 | commit_subject my-side@{u}@{1} >actual && |
| 114 | test_cmp expect actual && |
| 115 | commit_subject my-side@{U}@{1} >actual && |
| 116 | test_cmp expect actual |
Johannes Schindelin | 28fb843 | 2009-09-10 17:25:57 +0200 | [diff] [blame] | 117 | ' |
| 118 | |
| 119 | test_expect_success '@{u} without specifying branch fails on a detached HEAD' ' |
| 120 | git checkout HEAD^0 && |
Ævar Arnfjörð Bjarmason | 244ea1b | 2017-03-27 11:16:55 +0000 | [diff] [blame] | 121 | test_must_fail git rev-parse @{u} && |
| 122 | test_must_fail git rev-parse @{U} |
Johannes Schindelin | 28fb843 | 2009-09-10 17:25:57 +0200 | [diff] [blame] | 123 | ' |
| 124 | |
Junio C Hamano | 69add8e | 2010-01-20 01:08:48 -0800 | [diff] [blame] | 125 | test_expect_success 'checkout -b new my-side@{u} forks from the same' ' |
| 126 | ( |
| 127 | cd clone && |
| 128 | git checkout -b new my-side@{u} && |
| 129 | git rev-parse --symbolic-full-name my-side@{u} >expect && |
| 130 | git rev-parse --symbolic-full-name new@{u} >actual && |
| 131 | test_cmp expect actual |
| 132 | ) |
| 133 | ' |
| 134 | |
Junio C Hamano | ae0ba8e | 2010-01-19 23:17:11 -0800 | [diff] [blame] | 135 | test_expect_success 'merge my-side@{u} records the correct name' ' |
Junio C Hamano | 69add8e | 2010-01-20 01:08:48 -0800 | [diff] [blame] | 136 | ( |
Eric Sunshine | 8327974 | 2018-07-01 20:23:41 -0400 | [diff] [blame] | 137 | cd clone && |
Johannes Schindelin | 06d5314 | 2020-11-18 23:44:21 +0000 | [diff] [blame] | 138 | git checkout main && |
Eric Sunshine | 8327974 | 2018-07-01 20:23:41 -0400 | [diff] [blame] | 139 | test_might_fail git branch -D new && |
Junio C Hamano | 69add8e | 2010-01-20 01:08:48 -0800 | [diff] [blame] | 140 | git branch -t new my-side@{u} && |
| 141 | git merge -s ours new@{u} && |
Max Kirillov | ad2f725 | 2014-05-15 01:12:45 +0300 | [diff] [blame] | 142 | git show -s --pretty=tformat:%s >actual && |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 143 | echo "Merge remote-tracking branch ${SQ}origin/side${SQ}" >expect && |
Junio C Hamano | 69add8e | 2010-01-20 01:08:48 -0800 | [diff] [blame] | 144 | test_cmp expect actual |
| 145 | ) |
| 146 | ' |
| 147 | |
Junio C Hamano | ae0ba8e | 2010-01-19 23:17:11 -0800 | [diff] [blame] | 148 | test_expect_success 'branch -d other@{u}' ' |
Johannes Schindelin | 06d5314 | 2020-11-18 23:44:21 +0000 | [diff] [blame] | 149 | git checkout -t -b other main && |
Junio C Hamano | 69add8e | 2010-01-20 01:08:48 -0800 | [diff] [blame] | 150 | git branch -d @{u} && |
Johannes Schindelin | 06d5314 | 2020-11-18 23:44:21 +0000 | [diff] [blame] | 151 | git for-each-ref refs/heads/main >actual && |
Ævar Arnfjörð Bjarmason | d3c6751 | 2018-07-27 17:48:11 +0000 | [diff] [blame] | 152 | test_must_be_empty actual |
Junio C Hamano | 69add8e | 2010-01-20 01:08:48 -0800 | [diff] [blame] | 153 | ' |
| 154 | |
Junio C Hamano | ae0ba8e | 2010-01-19 23:17:11 -0800 | [diff] [blame] | 155 | test_expect_success 'checkout other@{u}' ' |
Johannes Schindelin | 06d5314 | 2020-11-18 23:44:21 +0000 | [diff] [blame] | 156 | git branch -f main HEAD && |
| 157 | git checkout -t -b another main && |
Junio C Hamano | 69add8e | 2010-01-20 01:08:48 -0800 | [diff] [blame] | 158 | git checkout @{u} && |
| 159 | git symbolic-ref HEAD >actual && |
Johannes Schindelin | 06d5314 | 2020-11-18 23:44:21 +0000 | [diff] [blame] | 160 | echo refs/heads/main >expect && |
Junio C Hamano | 69add8e | 2010-01-20 01:08:48 -0800 | [diff] [blame] | 161 | test_cmp expect actual |
| 162 | ' |
| 163 | |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 164 | test_expect_success 'branch@{u} works when tracking a local branch' ' |
Johannes Schindelin | 06d5314 | 2020-11-18 23:44:21 +0000 | [diff] [blame] | 165 | echo refs/heads/main >expect && |
| 166 | git -C clone rev-parse --symbolic-full-name local-main@{u} >actual && |
Denton Liu | 5236fce | 2019-12-20 10:16:00 -0800 | [diff] [blame] | 167 | test_cmp expect actual |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 168 | ' |
| 169 | |
| 170 | test_expect_success 'branch@{u} error message when no upstream' ' |
| 171 | cat >expect <<-EOF && |
Denton Liu | bd482d6 | 2019-09-05 15:10:05 -0700 | [diff] [blame] | 172 | fatal: no upstream configured for branch ${SQ}non-tracking${SQ} |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 173 | EOF |
SZEDER Gábor | c3a4456 | 2018-02-24 00:39:43 +0100 | [diff] [blame] | 174 | error_message non-tracking@{u} && |
Ævar Arnfjörð Bjarmason | 1108cea | 2021-02-11 02:53:53 +0100 | [diff] [blame] | 175 | test_cmp expect error |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 176 | ' |
| 177 | |
| 178 | test_expect_success '@{u} error message when no upstream' ' |
| 179 | cat >expect <<-EOF && |
Johannes Schindelin | 06d5314 | 2020-11-18 23:44:21 +0000 | [diff] [blame] | 180 | fatal: no upstream configured for branch ${SQ}main${SQ} |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 181 | EOF |
| 182 | test_must_fail git rev-parse --verify @{u} 2>actual && |
Ævar Arnfjörð Bjarmason | 1108cea | 2021-02-11 02:53:53 +0100 | [diff] [blame] | 183 | test_cmp expect actual |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 184 | ' |
| 185 | |
| 186 | test_expect_success 'branch@{u} error message with misspelt branch' ' |
| 187 | cat >expect <<-EOF && |
Denton Liu | bd482d6 | 2019-09-05 15:10:05 -0700 | [diff] [blame] | 188 | fatal: no such branch: ${SQ}no-such-branch${SQ} |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 189 | EOF |
SZEDER Gábor | c3a4456 | 2018-02-24 00:39:43 +0100 | [diff] [blame] | 190 | error_message no-such-branch@{u} && |
Ævar Arnfjörð Bjarmason | 1108cea | 2021-02-11 02:53:53 +0100 | [diff] [blame] | 191 | test_cmp expect error |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 192 | ' |
| 193 | |
| 194 | test_expect_success '@{u} error message when not on a branch' ' |
| 195 | cat >expect <<-EOF && |
Ramkumar Ramachandra | 17bf4ff | 2013-05-22 16:09:54 +0530 | [diff] [blame] | 196 | fatal: HEAD does not point to a branch |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 197 | EOF |
| 198 | git checkout HEAD^0 && |
| 199 | test_must_fail git rev-parse --verify @{u} 2>actual && |
Ævar Arnfjörð Bjarmason | 1108cea | 2021-02-11 02:53:53 +0100 | [diff] [blame] | 200 | test_cmp expect actual |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 201 | ' |
| 202 | |
| 203 | test_expect_success 'branch@{u} error message if upstream branch not fetched' ' |
| 204 | cat >expect <<-EOF && |
Denton Liu | bd482d6 | 2019-09-05 15:10:05 -0700 | [diff] [blame] | 205 | fatal: upstream branch ${SQ}refs/heads/side${SQ} not stored as a remote-tracking branch |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 206 | EOF |
SZEDER Gábor | c3a4456 | 2018-02-24 00:39:43 +0100 | [diff] [blame] | 207 | error_message bad-upstream@{u} && |
Ævar Arnfjörð Bjarmason | 1108cea | 2021-02-11 02:53:53 +0100 | [diff] [blame] | 208 | test_cmp expect error |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 209 | ' |
| 210 | |
| 211 | test_expect_success 'pull works when tracking a local branch' ' |
| 212 | ( |
| 213 | cd clone && |
Johannes Schindelin | 06d5314 | 2020-11-18 23:44:21 +0000 | [diff] [blame] | 214 | git checkout local-main && |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 215 | git pull |
| 216 | ) |
| 217 | ' |
| 218 | |
| 219 | # makes sense if the previous one succeeded |
| 220 | test_expect_success '@{u} works when tracking a local branch' ' |
Johannes Schindelin | 06d5314 | 2020-11-18 23:44:21 +0000 | [diff] [blame] | 221 | echo refs/heads/main >expect && |
Denton Liu | b441717 | 2019-12-20 10:16:02 -0800 | [diff] [blame] | 222 | git -C clone rev-parse --symbolic-full-name @{u} >actual && |
Denton Liu | 5236fce | 2019-12-20 10:16:00 -0800 | [diff] [blame] | 223 | test_cmp expect actual |
Zbigniew Jędrzejewski-Szmek | 1b4aee9 | 2012-04-14 09:54:31 +0200 | [diff] [blame] | 224 | ' |
| 225 | |
Junio C Hamano | 105e473 | 2010-01-26 13:48:28 -0800 | [diff] [blame] | 226 | test_expect_success 'log -g other@{u}' ' |
Denton Liu | 9291e63 | 2019-12-20 10:16:01 -0800 | [diff] [blame] | 227 | commit=$(git rev-parse HEAD) && |
| 228 | cat >expect <<-EOF && |
| 229 | commit $commit |
Johannes Schindelin | 06d5314 | 2020-11-18 23:44:21 +0000 | [diff] [blame] | 230 | Reflog: main@{0} (C O Mitter <committer@example.com>) |
Denton Liu | 9291e63 | 2019-12-20 10:16:01 -0800 | [diff] [blame] | 231 | Reflog message: branch: Created from HEAD |
| 232 | Author: A U Thor <author@example.com> |
| 233 | Date: Thu Apr 7 15:15:13 2005 -0700 |
| 234 | |
| 235 | 3 |
| 236 | EOF |
Junio C Hamano | 105e473 | 2010-01-26 13:48:28 -0800 | [diff] [blame] | 237 | git log -1 -g other@{u} >actual && |
| 238 | test_cmp expect actual |
| 239 | ' |
| 240 | |
Junio C Hamano | 105e473 | 2010-01-26 13:48:28 -0800 | [diff] [blame] | 241 | test_expect_success 'log -g other@{u}@{now}' ' |
Denton Liu | 9291e63 | 2019-12-20 10:16:01 -0800 | [diff] [blame] | 242 | commit=$(git rev-parse HEAD) && |
| 243 | cat >expect <<-EOF && |
| 244 | commit $commit |
Johannes Schindelin | 06d5314 | 2020-11-18 23:44:21 +0000 | [diff] [blame] | 245 | Reflog: main@{Thu Apr 7 15:17:13 2005 -0700} (C O Mitter <committer@example.com>) |
Denton Liu | 9291e63 | 2019-12-20 10:16:01 -0800 | [diff] [blame] | 246 | Reflog message: branch: Created from HEAD |
| 247 | Author: A U Thor <author@example.com> |
| 248 | Date: Thu Apr 7 15:15:13 2005 -0700 |
| 249 | |
| 250 | 3 |
| 251 | EOF |
Junio C Hamano | 105e473 | 2010-01-26 13:48:28 -0800 | [diff] [blame] | 252 | git log -1 -g other@{u}@{now} >actual && |
| 253 | test_cmp expect actual |
| 254 | ' |
| 255 | |
Jeff King | 3f6eb30 | 2014-01-15 03:37:23 -0500 | [diff] [blame] | 256 | test_expect_success '@{reflog}-parsing does not look beyond colon' ' |
| 257 | echo content >@{yesterday} && |
| 258 | git add @{yesterday} && |
| 259 | git commit -m "funny reflog file" && |
| 260 | git hash-object @{yesterday} >expect && |
| 261 | git rev-parse HEAD:@{yesterday} >actual |
| 262 | ' |
| 263 | |
| 264 | test_expect_success '@{upstream}-parsing does not look beyond colon' ' |
| 265 | echo content >@{upstream} && |
| 266 | git add @{upstream} && |
| 267 | git commit -m "funny upstream file" && |
| 268 | git hash-object @{upstream} >expect && |
| 269 | git rev-parse HEAD:@{upstream} >actual |
| 270 | ' |
| 271 | |
Johannes Schindelin | 28fb843 | 2009-09-10 17:25:57 +0200 | [diff] [blame] | 272 | test_done |