Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='git log' |
| 4 | |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +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 | |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 8 | . ./test-lib.sh |
Zoltan Klinger | cf3983d | 2014-07-09 12:10:21 +1000 | [diff] [blame] | 9 | . "$TEST_DIRECTORY/lib-gpg.sh" |
Alex Henrie | 940a911 | 2017-03-23 23:46:31 -0600 | [diff] [blame] | 10 | . "$TEST_DIRECTORY/lib-terminal.sh" |
Abhishek Kumar | 989eea9 | 2020-02-24 19:08:13 +0530 | [diff] [blame] | 11 | . "$TEST_DIRECTORY/lib-log-graph.sh" |
| 12 | |
| 13 | test_cmp_graph () { |
| 14 | lib_test_cmp_graph --format=%s "$@" |
| 15 | } |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 16 | |
| 17 | test_expect_success setup ' |
| 18 | |
| 19 | echo one >one && |
| 20 | git add one && |
| 21 | test_tick && |
| 22 | git commit -m initial && |
| 23 | |
| 24 | echo ichi >one && |
| 25 | git add one && |
| 26 | test_tick && |
| 27 | git commit -m second && |
| 28 | |
Arjen Laarhoven | d930508 | 2009-01-22 17:37:24 +0100 | [diff] [blame] | 29 | git mv one ichi && |
| 30 | test_tick && |
| 31 | git commit -m third && |
| 32 | |
| 33 | cp ichi ein && |
| 34 | git add ein && |
| 35 | test_tick && |
| 36 | git commit -m fourth && |
| 37 | |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 38 | mkdir a && |
| 39 | echo ni >a/two && |
| 40 | git add a/two && |
| 41 | test_tick && |
Arjen Laarhoven | d930508 | 2009-01-22 17:37:24 +0100 | [diff] [blame] | 42 | git commit -m fifth && |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 43 | |
Arjen Laarhoven | d930508 | 2009-01-22 17:37:24 +0100 | [diff] [blame] | 44 | git rm a/two && |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 45 | test_tick && |
Arjen Laarhoven | d930508 | 2009-01-22 17:37:24 +0100 | [diff] [blame] | 46 | git commit -m sixth |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 47 | |
| 48 | ' |
| 49 | |
Felipe Contreras | bb93afd | 2009-02-24 23:06:37 +0200 | [diff] [blame] | 50 | printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect |
| 51 | test_expect_success 'pretty' ' |
| 52 | |
| 53 | git log --pretty="format:%s" > actual && |
| 54 | test_cmp expect actual |
| 55 | ' |
| 56 | |
| 57 | printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial\n" > expect |
| 58 | test_expect_success 'pretty (tformat)' ' |
| 59 | |
| 60 | git log --pretty="tformat:%s" > actual && |
| 61 | test_cmp expect actual |
| 62 | ' |
| 63 | |
| 64 | test_expect_success 'pretty (shortcut)' ' |
| 65 | |
| 66 | git log --pretty="%s" > actual && |
| 67 | test_cmp expect actual |
| 68 | ' |
| 69 | |
| 70 | test_expect_success 'format' ' |
| 71 | |
| 72 | git log --format="%s" > actual && |
| 73 | test_cmp expect actual |
| 74 | ' |
| 75 | |
| 76 | cat > expect << EOF |
René Scharfe | 37bb5d7 | 2009-11-22 17:15:29 +0100 | [diff] [blame] | 77 | This is |
| 78 | the sixth |
| 79 | commit. |
| 80 | This is |
| 81 | the fifth |
| 82 | commit. |
| 83 | EOF |
| 84 | |
Jan H. Schönherr | 14e1a4e | 2012-10-18 16:43:28 +0200 | [diff] [blame] | 85 | test_expect_success 'format %w(11,1,2)' ' |
René Scharfe | 37bb5d7 | 2009-11-22 17:15:29 +0100 | [diff] [blame] | 86 | |
Jan H. Schönherr | 14e1a4e | 2012-10-18 16:43:28 +0200 | [diff] [blame] | 87 | git log -2 --format="%w(11,1,2)This is the %s commit." > actual && |
René Scharfe | 37bb5d7 | 2009-11-22 17:15:29 +0100 | [diff] [blame] | 88 | test_cmp expect actual |
| 89 | ' |
| 90 | |
| 91 | test_expect_success 'format %w(,1,2)' ' |
| 92 | |
| 93 | git log -2 --format="%w(,1,2)This is%nthe %s%ncommit." > actual && |
| 94 | test_cmp expect actual |
| 95 | ' |
| 96 | |
| 97 | cat > expect << EOF |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 98 | $(git rev-parse --short :/sixth ) sixth |
| 99 | $(git rev-parse --short :/fifth ) fifth |
| 100 | $(git rev-parse --short :/fourth ) fourth |
| 101 | $(git rev-parse --short :/third ) third |
| 102 | $(git rev-parse --short :/second ) second |
| 103 | $(git rev-parse --short :/initial) initial |
Felipe Contreras | bb93afd | 2009-02-24 23:06:37 +0200 | [diff] [blame] | 104 | EOF |
| 105 | test_expect_success 'oneline' ' |
| 106 | |
| 107 | git log --oneline > actual && |
| 108 | test_cmp expect actual |
| 109 | ' |
| 110 | |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 111 | test_expect_success 'diff-filter=A' ' |
| 112 | |
Matthieu Moy | 5404c11 | 2016-02-25 09:59:21 +0100 | [diff] [blame] | 113 | git log --no-renames --pretty="format:%s" --diff-filter=A HEAD > actual && |
| 114 | git log --no-renames --pretty="format:%s" --diff-filter A HEAD > actual-separate && |
Matthieu Moy | dea007f | 2010-08-05 10:22:52 +0200 | [diff] [blame] | 115 | printf "fifth\nfourth\nthird\ninitial" > expect && |
| 116 | test_cmp expect actual && |
| 117 | test_cmp expect actual-separate |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 118 | |
| 119 | ' |
| 120 | |
| 121 | test_expect_success 'diff-filter=M' ' |
| 122 | |
Eric Sunshine | 88511d2 | 2021-12-09 00:11:00 -0500 | [diff] [blame] | 123 | git log --pretty="format:%s" --diff-filter=M HEAD >actual && |
| 124 | printf "second" >expect && |
| 125 | test_cmp expect actual |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 126 | |
| 127 | ' |
| 128 | |
| 129 | test_expect_success 'diff-filter=D' ' |
| 130 | |
Eric Sunshine | 88511d2 | 2021-12-09 00:11:00 -0500 | [diff] [blame] | 131 | git log --no-renames --pretty="format:%s" --diff-filter=D HEAD >actual && |
| 132 | printf "sixth\nthird" >expect && |
| 133 | test_cmp expect actual |
Arjen Laarhoven | d930508 | 2009-01-22 17:37:24 +0100 | [diff] [blame] | 134 | |
| 135 | ' |
| 136 | |
| 137 | test_expect_success 'diff-filter=R' ' |
| 138 | |
Eric Sunshine | 88511d2 | 2021-12-09 00:11:00 -0500 | [diff] [blame] | 139 | git log -M --pretty="format:%s" --diff-filter=R HEAD >actual && |
| 140 | printf "third" >expect && |
| 141 | test_cmp expect actual |
Arjen Laarhoven | d930508 | 2009-01-22 17:37:24 +0100 | [diff] [blame] | 142 | |
| 143 | ' |
| 144 | |
Johannes Schindelin | 75408ca | 2022-01-28 12:02:50 +0000 | [diff] [blame] | 145 | test_expect_success 'multiple --diff-filter bits' ' |
| 146 | |
| 147 | git log -M --pretty="format:%s" --diff-filter=R HEAD >expect && |
| 148 | git log -M --pretty="format:%s" --diff-filter=Ra HEAD >actual && |
| 149 | test_cmp expect actual && |
| 150 | git log -M --pretty="format:%s" --diff-filter=aR HEAD >actual && |
| 151 | test_cmp expect actual && |
| 152 | git log -M --pretty="format:%s" \ |
| 153 | --diff-filter=a --diff-filter=R HEAD >actual && |
| 154 | test_cmp expect actual |
| 155 | |
| 156 | ' |
| 157 | |
Arjen Laarhoven | d930508 | 2009-01-22 17:37:24 +0100 | [diff] [blame] | 158 | test_expect_success 'diff-filter=C' ' |
| 159 | |
Eric Sunshine | 88511d2 | 2021-12-09 00:11:00 -0500 | [diff] [blame] | 160 | git log -C -C --pretty="format:%s" --diff-filter=C HEAD >actual && |
| 161 | printf "fourth" >expect && |
| 162 | test_cmp expect actual |
Arjen Laarhoven | d930508 | 2009-01-22 17:37:24 +0100 | [diff] [blame] | 163 | |
| 164 | ' |
| 165 | |
| 166 | test_expect_success 'git log --follow' ' |
| 167 | |
Eric Sunshine | 88511d2 | 2021-12-09 00:11:00 -0500 | [diff] [blame] | 168 | git log --follow --pretty="format:%s" ichi >actual && |
| 169 | printf "third\nsecond\ninitial" >expect && |
| 170 | test_cmp expect actual |
David Turner | 076c983 | 2015-07-07 21:29:34 -0400 | [diff] [blame] | 171 | ' |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 172 | |
David Turner | 076c983 | 2015-07-07 21:29:34 -0400 | [diff] [blame] | 173 | test_expect_success 'git config log.follow works like --follow' ' |
| 174 | test_config log.follow true && |
Eric Sunshine | 88511d2 | 2021-12-09 00:11:00 -0500 | [diff] [blame] | 175 | git log --pretty="format:%s" ichi >actual && |
| 176 | printf "third\nsecond\ninitial" >expect && |
| 177 | test_cmp expect actual |
David Turner | 076c983 | 2015-07-07 21:29:34 -0400 | [diff] [blame] | 178 | ' |
| 179 | |
| 180 | test_expect_success 'git config log.follow does not die with multiple paths' ' |
| 181 | test_config log.follow true && |
| 182 | git log --pretty="format:%s" ichi ein |
| 183 | ' |
| 184 | |
| 185 | test_expect_success 'git config log.follow does not die with no paths' ' |
| 186 | test_config log.follow true && |
| 187 | git log -- |
| 188 | ' |
| 189 | |
| 190 | test_expect_success 'git config log.follow is overridden by --no-follow' ' |
| 191 | test_config log.follow true && |
Eric Sunshine | 88511d2 | 2021-12-09 00:11:00 -0500 | [diff] [blame] | 192 | git log --no-follow --pretty="format:%s" ichi >actual && |
| 193 | printf "third" >expect && |
| 194 | test_cmp expect actual |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 195 | ' |
| 196 | |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 197 | # Note that these commits are intentionally listed out of order. |
| 198 | last_three="$(git rev-parse :/fourth :/sixth :/fifth)" |
Michael J Gruber | d5cee0f | 2009-07-17 16:28:06 +0200 | [diff] [blame] | 199 | cat > expect << EOF |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 200 | $(git rev-parse --short :/sixth ) sixth |
| 201 | $(git rev-parse --short :/fifth ) fifth |
| 202 | $(git rev-parse --short :/fourth) fourth |
Michael J Gruber | d5cee0f | 2009-07-17 16:28:06 +0200 | [diff] [blame] | 203 | EOF |
| 204 | test_expect_success 'git log --no-walk <commits> sorts by commit time' ' |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 205 | git log --no-walk --oneline $last_three > actual && |
Michael J Gruber | d5cee0f | 2009-07-17 16:28:06 +0200 | [diff] [blame] | 206 | test_cmp expect actual |
| 207 | ' |
| 208 | |
Martin von Zweigbergk | ca92e59 | 2012-08-28 23:15:54 -0700 | [diff] [blame] | 209 | test_expect_success 'git log --no-walk=sorted <commits> sorts by commit time' ' |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 210 | git log --no-walk=sorted --oneline $last_three > actual && |
Martin von Zweigbergk | ca92e59 | 2012-08-28 23:15:54 -0700 | [diff] [blame] | 211 | test_cmp expect actual |
| 212 | ' |
| 213 | |
Michael J Gruber | d5cee0f | 2009-07-17 16:28:06 +0200 | [diff] [blame] | 214 | cat > expect << EOF |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 215 | === $(git rev-parse --short :/sixth ) sixth |
| 216 | === $(git rev-parse --short :/fifth ) fifth |
| 217 | === $(git rev-parse --short :/fourth) fourth |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 218 | EOF |
| 219 | test_expect_success 'git log --line-prefix="=== " --no-walk <commits> sorts by commit time' ' |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 220 | git log --line-prefix="=== " --no-walk --oneline $last_three > actual && |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 221 | test_cmp expect actual |
| 222 | ' |
| 223 | |
| 224 | cat > expect << EOF |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 225 | $(git rev-parse --short :/fourth) fourth |
| 226 | $(git rev-parse --short :/sixth ) sixth |
| 227 | $(git rev-parse --short :/fifth ) fifth |
Michael J Gruber | d5cee0f | 2009-07-17 16:28:06 +0200 | [diff] [blame] | 228 | EOF |
Martin von Zweigbergk | ca92e59 | 2012-08-28 23:15:54 -0700 | [diff] [blame] | 229 | test_expect_success 'git log --no-walk=unsorted <commits> leaves list of commits as given' ' |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 230 | git log --no-walk=unsorted --oneline $last_three > actual && |
Martin von Zweigbergk | ca92e59 | 2012-08-28 23:15:54 -0700 | [diff] [blame] | 231 | test_cmp expect actual |
| 232 | ' |
| 233 | |
Michael J Gruber | d5cee0f | 2009-07-17 16:28:06 +0200 | [diff] [blame] | 234 | test_expect_success 'git show <commits> leaves list of commits as given' ' |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 235 | git show --oneline -s $last_three > actual && |
Michael J Gruber | d5cee0f | 2009-07-17 16:28:06 +0200 | [diff] [blame] | 236 | test_cmp expect actual |
| 237 | ' |
| 238 | |
Jeff King | 0843acf | 2008-08-25 02:15:05 -0400 | [diff] [blame] | 239 | test_expect_success 'setup case sensitivity tests' ' |
| 240 | echo case >one && |
| 241 | test_tick && |
Jonathan Nieder | a48fcd8 | 2010-10-30 20:46:54 -0500 | [diff] [blame] | 242 | git add one && |
Jeff King | 0843acf | 2008-08-25 02:15:05 -0400 | [diff] [blame] | 243 | git commit -a -m Second |
| 244 | ' |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 245 | |
Jeff King | 0843acf | 2008-08-25 02:15:05 -0400 | [diff] [blame] | 246 | test_expect_success 'log --grep' ' |
| 247 | echo second >expect && |
| 248 | git log -1 --pretty="tformat:%s" --grep=sec >actual && |
| 249 | test_cmp expect actual |
| 250 | ' |
| 251 | |
Ævar Arnfjörð Bjarmason | db84376 | 2022-10-11 11:48:45 +0200 | [diff] [blame] | 252 | for noop_opt in --invert-grep --all-match |
| 253 | do |
| 254 | test_expect_success "log $noop_opt without --grep is a NOOP" ' |
| 255 | git log >expect && |
| 256 | git log $noop_opt >actual && |
| 257 | test_cmp expect actual |
| 258 | ' |
| 259 | done |
| 260 | |
Christoph Junghans | 22dfa8a | 2015-01-12 18:33:32 -0700 | [diff] [blame] | 261 | cat > expect << EOF |
| 262 | second |
| 263 | initial |
| 264 | EOF |
| 265 | test_expect_success 'log --invert-grep --grep' ' |
Ævar Arnfjörð Bjarmason | 9e3cbc5 | 2017-05-20 21:42:08 +0000 | [diff] [blame] | 266 | # Fixed |
| 267 | git -c grep.patternType=fixed log --pretty="tformat:%s" --invert-grep --grep=th --grep=Sec >actual && |
| 268 | test_cmp expect actual && |
| 269 | |
| 270 | # POSIX basic |
| 271 | git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual && |
| 272 | test_cmp expect actual && |
| 273 | |
| 274 | # POSIX extended |
René Scharfe | e6a9bc0 | 2021-12-17 17:48:52 +0100 | [diff] [blame] | 275 | git -c grep.patternType=extended log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual && |
Ævar Arnfjörð Bjarmason | 9e3cbc5 | 2017-05-20 21:42:08 +0000 | [diff] [blame] | 276 | test_cmp expect actual && |
| 277 | |
| 278 | # PCRE |
| 279 | if test_have_prereq PCRE |
| 280 | then |
| 281 | git -c grep.patternType=perl log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual && |
| 282 | test_cmp expect actual |
| 283 | fi |
Christoph Junghans | 22dfa8a | 2015-01-12 18:33:32 -0700 | [diff] [blame] | 284 | ' |
| 285 | |
| 286 | test_expect_success 'log --invert-grep --grep -i' ' |
| 287 | echo initial >expect && |
Ævar Arnfjörð Bjarmason | 9e3cbc5 | 2017-05-20 21:42:08 +0000 | [diff] [blame] | 288 | |
| 289 | # Fixed |
| 290 | git -c grep.patternType=fixed log --pretty="tformat:%s" --invert-grep -i --grep=th --grep=Sec >actual && |
| 291 | test_cmp expect actual && |
| 292 | |
| 293 | # POSIX basic |
| 294 | git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual && |
| 295 | test_cmp expect actual && |
| 296 | |
| 297 | # POSIX extended |
| 298 | git -c grep.patternType=extended log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual && |
| 299 | test_cmp expect actual && |
| 300 | |
| 301 | # PCRE |
| 302 | if test_have_prereq PCRE |
| 303 | then |
| 304 | git -c grep.patternType=perl log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual && |
| 305 | test_cmp expect actual |
| 306 | fi |
Christoph Junghans | 22dfa8a | 2015-01-12 18:33:32 -0700 | [diff] [blame] | 307 | ' |
| 308 | |
Matthieu Moy | 7d7b86f | 2010-08-05 10:22:55 +0200 | [diff] [blame] | 309 | test_expect_success 'log --grep option parsing' ' |
| 310 | echo second >expect && |
| 311 | git log -1 --pretty="tformat:%s" --grep sec >actual && |
| 312 | test_cmp expect actual && |
| 313 | test_must_fail git log -1 --pretty="tformat:%s" --grep |
| 314 | ' |
| 315 | |
Jeff King | 0843acf | 2008-08-25 02:15:05 -0400 | [diff] [blame] | 316 | test_expect_success 'log -i --grep' ' |
| 317 | echo Second >expect && |
| 318 | git log -1 --pretty="tformat:%s" -i --grep=sec >actual && |
| 319 | test_cmp expect actual |
| 320 | ' |
| 321 | |
| 322 | test_expect_success 'log --grep -i' ' |
| 323 | echo Second >expect && |
Ævar Arnfjörð Bjarmason | 9e3cbc5 | 2017-05-20 21:42:08 +0000 | [diff] [blame] | 324 | |
| 325 | # Fixed |
Jeff King | 0843acf | 2008-08-25 02:15:05 -0400 | [diff] [blame] | 326 | git log -1 --pretty="tformat:%s" --grep=sec -i >actual && |
Ævar Arnfjörð Bjarmason | 9e3cbc5 | 2017-05-20 21:42:08 +0000 | [diff] [blame] | 327 | test_cmp expect actual && |
| 328 | |
| 329 | # POSIX basic |
| 330 | git -c grep.patternType=basic log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual && |
| 331 | test_cmp expect actual && |
| 332 | |
| 333 | # POSIX extended |
| 334 | git -c grep.patternType=extended log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual && |
| 335 | test_cmp expect actual && |
| 336 | |
| 337 | # PCRE |
| 338 | if test_have_prereq PCRE |
| 339 | then |
| 340 | git -c grep.patternType=perl log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual && |
| 341 | test_cmp expect actual |
| 342 | fi |
Jeff King | 0843acf | 2008-08-25 02:15:05 -0400 | [diff] [blame] | 343 | ' |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 344 | |
Junio C Hamano | 34a4ae5 | 2012-10-03 14:50:51 -0700 | [diff] [blame] | 345 | test_expect_success 'log -F -E --grep=<ere> uses ere' ' |
| 346 | echo second >expect && |
Ævar Arnfjörð Bjarmason | 9df4676 | 2017-05-20 21:42:07 +0000 | [diff] [blame] | 347 | # basic would need \(s\) to do the same |
| 348 | git log -1 --pretty="tformat:%s" -F -E --grep="(s).c.nd" >actual && |
| 349 | test_cmp expect actual |
| 350 | ' |
| 351 | |
| 352 | test_expect_success PCRE 'log -F -E --perl-regexp --grep=<pcre> uses PCRE' ' |
| 353 | test_when_finished "rm -rf num_commits" && |
| 354 | git init num_commits && |
| 355 | ( |
| 356 | cd num_commits && |
| 357 | test_commit 1d && |
| 358 | test_commit 2e |
| 359 | ) && |
| 360 | |
| 361 | # In PCRE \d in [\d] is like saying "0-9", and matches the 2 |
| 362 | # in 2e... |
| 363 | echo 2e >expect && |
| 364 | git -C num_commits log -1 --pretty="tformat:%s" -F -E --perl-regexp --grep="[\d]" >actual && |
| 365 | test_cmp expect actual && |
| 366 | |
| 367 | # ...in POSIX basic and extended it is the same as [d], |
| 368 | # i.e. "d", which matches 1d, but does not match 2e. |
| 369 | echo 1d >expect && |
| 370 | git -C num_commits log -1 --pretty="tformat:%s" -F -E --grep="[\d]" >actual && |
Junio C Hamano | 34a4ae5 | 2012-10-03 14:50:51 -0700 | [diff] [blame] | 371 | test_cmp expect actual |
| 372 | ' |
| 373 | |
Junio C Hamano | 8465541 | 2016-07-22 11:43:14 -0700 | [diff] [blame] | 374 | test_expect_success 'log with grep.patternType configuration' ' |
Junio C Hamano | 8465541 | 2016-07-22 11:43:14 -0700 | [diff] [blame] | 375 | git -c grep.patterntype=fixed \ |
| 376 | log -1 --pretty=tformat:%s --grep=s.c.nd >actual && |
Ævar Arnfjörð Bjarmason | d3c6751 | 2018-07-27 17:48:11 +0000 | [diff] [blame] | 377 | test_must_be_empty actual |
Junio C Hamano | 8465541 | 2016-07-22 11:43:14 -0700 | [diff] [blame] | 378 | ' |
| 379 | |
| 380 | test_expect_success 'log with grep.patternType configuration and command line' ' |
| 381 | echo second >expect && |
| 382 | git -c grep.patterntype=fixed \ |
| 383 | log -1 --pretty=tformat:%s --basic-regexp --grep=s.c.nd >actual && |
| 384 | test_cmp expect actual |
| 385 | ' |
| 386 | |
Ævar Arnfjörð Bjarmason | dfe1a17 | 2019-05-13 20:32:42 +0200 | [diff] [blame] | 387 | test_expect_success !FAIL_PREREQS 'log with various grep.patternType configurations & command-lines' ' |
Ævar Arnfjörð Bjarmason | 9df4676 | 2017-05-20 21:42:07 +0000 | [diff] [blame] | 388 | git init pattern-type && |
| 389 | ( |
| 390 | cd pattern-type && |
| 391 | test_commit 1 file A && |
| 392 | |
| 393 | # The tagname is overridden here because creating a |
| 394 | # tag called "(1|2)" as test_commit would otherwise |
| 395 | # implicitly do would fail on e.g. MINGW. |
| 396 | test_commit "(1|2)" file B 2 && |
| 397 | |
| 398 | echo "(1|2)" >expect.fixed && |
| 399 | cp expect.fixed expect.basic && |
| 400 | cp expect.fixed expect.extended && |
| 401 | cp expect.fixed expect.perl && |
| 402 | |
| 403 | # A strcmp-like match with fixed. |
| 404 | git -c grep.patternType=fixed log --pretty=tformat:%s \ |
| 405 | --grep="(1|2)" >actual.fixed && |
| 406 | |
| 407 | # POSIX basic matches (, | and ) literally. |
| 408 | git -c grep.patternType=basic log --pretty=tformat:%s \ |
| 409 | --grep="(.|.)" >actual.basic && |
| 410 | |
| 411 | # POSIX extended needs to have | escaped to match it |
| 412 | # literally, whereas under basic this is the same as |
| 413 | # (|2), i.e. it would also match "1". This test checks |
| 414 | # for extended by asserting that it is not matching |
| 415 | # what basic would match. |
| 416 | git -c grep.patternType=extended log --pretty=tformat:%s \ |
| 417 | --grep="\|2" >actual.extended && |
| 418 | if test_have_prereq PCRE |
| 419 | then |
| 420 | # Only PCRE would match [\d]\| with only |
| 421 | # "(1|2)" due to [\d]. POSIX basic would match |
| 422 | # both it and "1" since similarly to the |
| 423 | # extended match above it is the same as |
| 424 | # \([\d]\|\). POSIX extended would |
| 425 | # match neither. |
| 426 | git -c grep.patternType=perl log --pretty=tformat:%s \ |
| 427 | --grep="[\d]\|" >actual.perl && |
| 428 | test_cmp expect.perl actual.perl |
| 429 | fi && |
| 430 | test_cmp expect.fixed actual.fixed && |
| 431 | test_cmp expect.basic actual.basic && |
| 432 | test_cmp expect.extended actual.extended && |
| 433 | |
| 434 | git log --pretty=tformat:%s -F \ |
| 435 | --grep="(1|2)" >actual.fixed.short-arg && |
| 436 | git log --pretty=tformat:%s -E \ |
| 437 | --grep="\|2" >actual.extended.short-arg && |
Ævar Arnfjörð Bjarmason | 7531a2d | 2017-05-25 20:05:24 +0000 | [diff] [blame] | 438 | if test_have_prereq PCRE |
| 439 | then |
| 440 | git log --pretty=tformat:%s -P \ |
| 441 | --grep="[\d]\|" >actual.perl.short-arg |
| 442 | else |
| 443 | test_must_fail git log -P \ |
| 444 | --grep="[\d]\|" |
| 445 | fi && |
Ævar Arnfjörð Bjarmason | 9df4676 | 2017-05-20 21:42:07 +0000 | [diff] [blame] | 446 | test_cmp expect.fixed actual.fixed.short-arg && |
| 447 | test_cmp expect.extended actual.extended.short-arg && |
Ævar Arnfjörð Bjarmason | 7531a2d | 2017-05-25 20:05:24 +0000 | [diff] [blame] | 448 | if test_have_prereq PCRE |
| 449 | then |
| 450 | test_cmp expect.perl actual.perl.short-arg |
| 451 | fi && |
Ævar Arnfjörð Bjarmason | 9df4676 | 2017-05-20 21:42:07 +0000 | [diff] [blame] | 452 | |
| 453 | git log --pretty=tformat:%s --fixed-strings \ |
| 454 | --grep="(1|2)" >actual.fixed.long-arg && |
| 455 | git log --pretty=tformat:%s --basic-regexp \ |
| 456 | --grep="(.|.)" >actual.basic.long-arg && |
| 457 | git log --pretty=tformat:%s --extended-regexp \ |
| 458 | --grep="\|2" >actual.extended.long-arg && |
| 459 | if test_have_prereq PCRE |
| 460 | then |
| 461 | git log --pretty=tformat:%s --perl-regexp \ |
| 462 | --grep="[\d]\|" >actual.perl.long-arg && |
| 463 | test_cmp expect.perl actual.perl.long-arg |
Ævar Arnfjörð Bjarmason | 9001c19 | 2017-05-20 21:42:09 +0000 | [diff] [blame] | 464 | else |
| 465 | test_must_fail git log --perl-regexp \ |
| 466 | --grep="[\d]\|" |
Ævar Arnfjörð Bjarmason | 9df4676 | 2017-05-20 21:42:07 +0000 | [diff] [blame] | 467 | fi && |
| 468 | test_cmp expect.fixed actual.fixed.long-arg && |
| 469 | test_cmp expect.basic actual.basic.long-arg && |
| 470 | test_cmp expect.extended actual.extended.long-arg |
| 471 | ) |
| 472 | ' |
| 473 | |
Ævar Arnfjörð Bjarmason | ff37a60 | 2022-02-16 01:00:31 +0100 | [diff] [blame] | 474 | for cmd in show whatchanged reflog format-patch |
| 475 | do |
| 476 | case "$cmd" in |
| 477 | format-patch) myarg="HEAD~.." ;; |
| 478 | *) myarg= ;; |
| 479 | esac |
| 480 | |
| 481 | test_expect_success "$cmd: understands grep.patternType, like 'log'" ' |
| 482 | git init "pattern-type-$cmd" && |
| 483 | ( |
| 484 | cd "pattern-type-$cmd" && |
| 485 | test_commit 1 file A && |
| 486 | test_commit "(1|2)" file B 2 && |
| 487 | |
| 488 | git -c grep.patternType=fixed $cmd --grep="..." $myarg >actual && |
| 489 | test_must_be_empty actual && |
| 490 | |
| 491 | git -c grep.patternType=basic $cmd --grep="..." $myarg >actual && |
| 492 | test_file_not_empty actual |
| 493 | ) |
| 494 | ' |
| 495 | done |
Ævar Arnfjörð Bjarmason | ff37a60 | 2022-02-16 01:00:31 +0100 | [diff] [blame] | 496 | |
Hamza Mahfooz | 6a5c337 | 2021-10-07 16:31:47 -0400 | [diff] [blame] | 497 | test_expect_success 'log --author' ' |
| 498 | cat >expect <<-\EOF && |
| 499 | Author: <BOLD;RED>A U<RESET> Thor <author@example.com> |
| 500 | EOF |
| 501 | git log -1 --color=always --author="A U" >log && |
| 502 | grep Author log >actual.raw && |
| 503 | test_decode_color <actual.raw >actual && |
| 504 | test_cmp expect actual |
| 505 | ' |
| 506 | |
| 507 | test_expect_success 'log --committer' ' |
| 508 | cat >expect <<-\EOF && |
| 509 | Commit: C O Mitter <committer@<BOLD;RED>example<RESET>.com> |
| 510 | EOF |
| 511 | git log -1 --color=always --pretty=fuller --committer="example" >log && |
| 512 | grep "Commit:" log >actual.raw && |
| 513 | test_decode_color <actual.raw >actual && |
| 514 | test_cmp expect actual |
| 515 | ' |
| 516 | |
| 517 | test_expect_success 'log -i --grep with color' ' |
| 518 | cat >expect <<-\EOF && |
| 519 | <BOLD;RED>Sec<RESET>ond |
| 520 | <BOLD;RED>sec<RESET>ond |
| 521 | EOF |
| 522 | git log --color=always -i --grep=^sec >log && |
| 523 | grep -i sec log >actual.raw && |
| 524 | test_decode_color <actual.raw >actual && |
| 525 | test_cmp expect actual |
| 526 | ' |
| 527 | |
| 528 | test_expect_success '-c color.grep.selected log --grep' ' |
| 529 | cat >expect <<-\EOF && |
| 530 | <GREEN>th<RESET><BOLD;RED>ir<RESET><GREEN>d<RESET> |
| 531 | EOF |
| 532 | git -c color.grep.selected="green" log --color=always --grep=ir >log && |
| 533 | grep ir log >actual.raw && |
| 534 | test_decode_color <actual.raw >actual && |
| 535 | test_cmp expect actual |
| 536 | ' |
| 537 | |
| 538 | test_expect_success '-c color.grep.matchSelected log --grep' ' |
| 539 | cat >expect <<-\EOF && |
| 540 | <BLUE>i<RESET>n<BLUE>i<RESET>t<BLUE>i<RESET>al |
| 541 | EOF |
| 542 | git -c color.grep.matchSelected="blue" log --color=always --grep=i >log && |
| 543 | grep al log >actual.raw && |
| 544 | test_decode_color <actual.raw >actual && |
| 545 | test_cmp expect actual |
| 546 | ' |
| 547 | |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 548 | cat > expect <<EOF |
| 549 | * Second |
| 550 | * sixth |
| 551 | * fifth |
| 552 | * fourth |
| 553 | * third |
| 554 | * second |
| 555 | * initial |
| 556 | EOF |
| 557 | |
| 558 | test_expect_success 'simple log --graph' ' |
Abhishek Kumar | 989eea9 | 2020-02-24 19:08:13 +0530 | [diff] [blame] | 559 | test_cmp_graph |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 560 | ' |
| 561 | |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 562 | cat > expect <<EOF |
| 563 | 123 * Second |
| 564 | 123 * sixth |
| 565 | 123 * fifth |
| 566 | 123 * fourth |
| 567 | 123 * third |
| 568 | 123 * second |
| 569 | 123 * initial |
| 570 | EOF |
| 571 | |
| 572 | test_expect_success 'simple log --graph --line-prefix="123 "' ' |
Abhishek Kumar | 989eea9 | 2020-02-24 19:08:13 +0530 | [diff] [blame] | 573 | test_cmp_graph --line-prefix="123 " |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 574 | ' |
| 575 | |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 576 | test_expect_success 'set up merge history' ' |
| 577 | git checkout -b side HEAD~4 && |
| 578 | test_commit side-1 1 1 && |
| 579 | test_commit side-2 2 2 && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 580 | git checkout main && |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 581 | git merge side |
| 582 | ' |
| 583 | |
| 584 | cat > expect <<\EOF |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 585 | * Merge branch 'side' |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 586 | |\ |
| 587 | | * side-2 |
| 588 | | * side-1 |
| 589 | * | Second |
| 590 | * | sixth |
| 591 | * | fifth |
| 592 | * | fourth |
| 593 | |/ |
| 594 | * third |
| 595 | * second |
| 596 | * initial |
| 597 | EOF |
| 598 | |
| 599 | test_expect_success 'log --graph with merge' ' |
Abhishek Kumar | 989eea9 | 2020-02-24 19:08:13 +0530 | [diff] [blame] | 600 | test_cmp_graph --date-order |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 601 | ' |
| 602 | |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 603 | cat > expect <<\EOF |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 604 | | | | * Merge branch 'side' |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 605 | | | | |\ |
| 606 | | | | | * side-2 |
| 607 | | | | | * side-1 |
| 608 | | | | * | Second |
| 609 | | | | * | sixth |
| 610 | | | | * | fifth |
| 611 | | | | * | fourth |
| 612 | | | | |/ |
| 613 | | | | * third |
| 614 | | | | * second |
| 615 | | | | * initial |
| 616 | EOF |
| 617 | |
| 618 | test_expect_success 'log --graph --line-prefix="| | | " with merge' ' |
Abhishek Kumar | 989eea9 | 2020-02-24 19:08:13 +0530 | [diff] [blame] | 619 | test_cmp_graph --line-prefix="| | | " --date-order |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 620 | ' |
| 621 | |
Nguyễn Thái Ngọc Duy | 73c727d | 2017-01-19 18:41:23 +0700 | [diff] [blame] | 622 | cat > expect.colors <<\EOF |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 623 | * Merge branch 'side' |
Nguyễn Thái Ngọc Duy | 73c727d | 2017-01-19 18:41:23 +0700 | [diff] [blame] | 624 | <BLUE>|<RESET><CYAN>\<RESET> |
| 625 | <BLUE>|<RESET> * side-2 |
| 626 | <BLUE>|<RESET> * side-1 |
| 627 | * <CYAN>|<RESET> Second |
| 628 | * <CYAN>|<RESET> sixth |
| 629 | * <CYAN>|<RESET> fifth |
| 630 | * <CYAN>|<RESET> fourth |
| 631 | <CYAN>|<RESET><CYAN>/<RESET> |
| 632 | * third |
| 633 | * second |
| 634 | * initial |
| 635 | EOF |
| 636 | |
| 637 | test_expect_success 'log --graph with merge with log.graphColors' ' |
Jeff King | 55cccf4 | 2017-02-01 01:21:29 +0100 | [diff] [blame] | 638 | test_config log.graphColors " blue,invalid-color, cyan, red , " && |
Abhishek Kumar | ffe0055 | 2020-02-24 19:08:14 +0530 | [diff] [blame] | 639 | lib_test_cmp_colored_graph --date-order --format=%s |
Nguyễn Thái Ngọc Duy | 73c727d | 2017-01-19 18:41:23 +0700 | [diff] [blame] | 640 | ' |
| 641 | |
Michał Kiedrowicz | 656197a | 2009-07-25 01:45:00 +0200 | [diff] [blame] | 642 | test_expect_success 'log --raw --graph -m with merge' ' |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 643 | git log --raw --graph --oneline -m main | head -n 500 >actual && |
Michał Kiedrowicz | 656197a | 2009-07-25 01:45:00 +0200 | [diff] [blame] | 644 | grep "initial" actual |
| 645 | ' |
| 646 | |
| 647 | test_expect_success 'diff-tree --graph' ' |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 648 | git diff-tree --graph main^ | head -n 500 >actual && |
Michał Kiedrowicz | 656197a | 2009-07-25 01:45:00 +0200 | [diff] [blame] | 649 | grep "one" actual |
| 650 | ' |
| 651 | |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 652 | cat > expect <<\EOF |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 653 | * commit main |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 654 | |\ Merge: A B |
| 655 | | | Author: A U Thor <author@example.com> |
| 656 | | | |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 657 | | | Merge branch 'side' |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 658 | | | |
Junio C Hamano | ef1e740 | 2017-03-29 16:39:16 +0200 | [diff] [blame] | 659 | | * commit tags/side-2 |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 660 | | | Author: A U Thor <author@example.com> |
| 661 | | | |
| 662 | | | side-2 |
| 663 | | | |
| 664 | | * commit tags/side-1 |
| 665 | | | Author: A U Thor <author@example.com> |
| 666 | | | |
| 667 | | | side-1 |
| 668 | | | |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 669 | * | commit main~1 |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 670 | | | Author: A U Thor <author@example.com> |
| 671 | | | |
| 672 | | | Second |
| 673 | | | |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 674 | * | commit main~2 |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 675 | | | Author: A U Thor <author@example.com> |
| 676 | | | |
| 677 | | | sixth |
| 678 | | | |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 679 | * | commit main~3 |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 680 | | | Author: A U Thor <author@example.com> |
| 681 | | | |
| 682 | | | fifth |
| 683 | | | |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 684 | * | commit main~4 |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 685 | |/ Author: A U Thor <author@example.com> |
| 686 | | |
| 687 | | fourth |
| 688 | | |
| 689 | * commit tags/side-1~1 |
| 690 | | Author: A U Thor <author@example.com> |
| 691 | | |
| 692 | | third |
| 693 | | |
| 694 | * commit tags/side-1~2 |
| 695 | | Author: A U Thor <author@example.com> |
| 696 | | |
| 697 | | second |
| 698 | | |
| 699 | * commit tags/side-1~3 |
| 700 | Author: A U Thor <author@example.com> |
| 701 | |
| 702 | initial |
| 703 | EOF |
| 704 | |
| 705 | test_expect_success 'log --graph with full output' ' |
| 706 | git log --graph --date-order --pretty=short | |
John Cai | 34ae3b7 | 2022-01-05 23:29:31 +0000 | [diff] [blame] | 707 | git name-rev --name-only --annotate-stdin | |
Stephen Boyd | 9524cf2 | 2010-01-26 15:08:31 -0800 | [diff] [blame] | 708 | sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual && |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 709 | test_cmp expect actual |
| 710 | ' |
| 711 | |
| 712 | test_expect_success 'set up more tangled history' ' |
| 713 | git checkout -b tangle HEAD~6 && |
| 714 | test_commit tangle-a tangle-a a && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 715 | git merge main~3 && |
Derrick Stolee | 748706d | 2022-08-05 17:58:40 +0000 | [diff] [blame] | 716 | git update-ref refs/prefetch/merge HEAD && |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 717 | git merge side~1 && |
Derrick Stolee | 748706d | 2022-08-05 17:58:40 +0000 | [diff] [blame] | 718 | git update-ref refs/rewritten/merge HEAD && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 719 | git checkout main && |
Allan Caffee | 7b1d626 | 2009-04-22 17:27:15 -0400 | [diff] [blame] | 720 | git merge tangle && |
Derrick Stolee | 748706d | 2022-08-05 17:58:40 +0000 | [diff] [blame] | 721 | git update-ref refs/hidden/tangle HEAD && |
Allan Caffee | 7b1d626 | 2009-04-22 17:27:15 -0400 | [diff] [blame] | 722 | git checkout -b reach && |
| 723 | test_commit reach && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 724 | git checkout main && |
Allan Caffee | 7b1d626 | 2009-04-22 17:27:15 -0400 | [diff] [blame] | 725 | git checkout -b octopus-a && |
| 726 | test_commit octopus-a && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 727 | git checkout main && |
Allan Caffee | 7b1d626 | 2009-04-22 17:27:15 -0400 | [diff] [blame] | 728 | git checkout -b octopus-b && |
| 729 | test_commit octopus-b && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 730 | git checkout main && |
Allan Caffee | 7b1d626 | 2009-04-22 17:27:15 -0400 | [diff] [blame] | 731 | test_commit seventh && |
Jonathan Nieder | a48fcd8 | 2010-10-30 20:46:54 -0500 | [diff] [blame] | 732 | git merge octopus-a octopus-b && |
Allan Caffee | 7b1d626 | 2009-04-22 17:27:15 -0400 | [diff] [blame] | 733 | git merge reach |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 734 | ' |
| 735 | |
| 736 | cat > expect <<\EOF |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 737 | * Merge tag 'reach' |
Allan Caffee | 7b1d626 | 2009-04-22 17:27:15 -0400 | [diff] [blame] | 738 | |\ |
| 739 | | \ |
| 740 | | \ |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 741 | *-. \ Merge tags 'octopus-a' and 'octopus-b' |
Allan Caffee | 7b1d626 | 2009-04-22 17:27:15 -0400 | [diff] [blame] | 742 | |\ \ \ |
| 743 | * | | | seventh |
| 744 | | | * | octopus-b |
| 745 | | |/ / |
| 746 | |/| | |
| 747 | | * | octopus-a |
| 748 | |/ / |
| 749 | | * reach |
| 750 | |/ |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 751 | * Merge branch 'tangle' |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 752 | |\ |
| 753 | | * Merge branch 'side' (early part) into tangle |
| 754 | | |\ |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 755 | | * \ Merge branch 'main' (early part) into tangle |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 756 | | |\ \ |
| 757 | | * | | tangle-a |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 758 | * | | | Merge branch 'side' |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 759 | |\ \ \ \ |
| 760 | | * | | | side-2 |
Allan Caffee | eaf158f | 2009-04-21 08:47:01 -0400 | [diff] [blame] | 761 | | | |_|/ |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 762 | | |/| | |
| 763 | | * | | side-1 |
| 764 | * | | | Second |
| 765 | * | | | sixth |
Allan Caffee | eaf158f | 2009-04-21 08:47:01 -0400 | [diff] [blame] | 766 | | |_|/ |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 767 | |/| | |
| 768 | * | | fifth |
| 769 | * | | fourth |
| 770 | |/ / |
James Coglan | 479db18 | 2019-10-15 23:47:57 +0000 | [diff] [blame] | 771 | * / third |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 772 | |/ |
| 773 | * second |
| 774 | * initial |
| 775 | EOF |
| 776 | |
Linus Torvalds | 95110d7 | 2009-04-26 12:29:13 -0700 | [diff] [blame] | 777 | test_expect_success 'log --graph with merge' ' |
Abhishek Kumar | 989eea9 | 2020-02-24 19:08:13 +0530 | [diff] [blame] | 778 | test_cmp_graph --date-order |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 779 | ' |
| 780 | |
Junio C Hamano | 8a3d203 | 2010-02-17 10:20:49 -0800 | [diff] [blame] | 781 | test_expect_success 'log.decorate configuration' ' |
Alex Henrie | 940a911 | 2017-03-23 23:46:31 -0600 | [diff] [blame] | 782 | git log --oneline --no-decorate >expect.none && |
Junio C Hamano | 4f62c2b | 2010-04-08 10:17:17 -0700 | [diff] [blame] | 783 | git log --oneline --decorate >expect.short && |
| 784 | git log --oneline --decorate=full >expect.full && |
Junio C Hamano | 8a3d203 | 2010-02-17 10:20:49 -0800 | [diff] [blame] | 785 | |
| 786 | echo "[log] decorate" >>.git/config && |
Junio C Hamano | 635530a | 2010-04-06 14:48:55 -0700 | [diff] [blame] | 787 | git log --oneline >actual && |
Junio C Hamano | 4f62c2b | 2010-04-08 10:17:17 -0700 | [diff] [blame] | 788 | test_cmp expect.short actual && |
Junio C Hamano | 8a3d203 | 2010-02-17 10:20:49 -0800 | [diff] [blame] | 789 | |
Yann Droneaud | 90e76b7 | 2013-03-24 22:06:06 +0100 | [diff] [blame] | 790 | test_config log.decorate true && |
Junio C Hamano | 635530a | 2010-04-06 14:48:55 -0700 | [diff] [blame] | 791 | git log --oneline >actual && |
Junio C Hamano | 4f62c2b | 2010-04-08 10:17:17 -0700 | [diff] [blame] | 792 | test_cmp expect.short actual && |
| 793 | git log --oneline --decorate=full >actual && |
| 794 | test_cmp expect.full actual && |
| 795 | git log --oneline --decorate=no >actual && |
| 796 | test_cmp expect.none actual && |
Junio C Hamano | 8a3d203 | 2010-02-17 10:20:49 -0800 | [diff] [blame] | 797 | |
Yann Droneaud | 90e76b7 | 2013-03-24 22:06:06 +0100 | [diff] [blame] | 798 | test_config log.decorate no && |
Junio C Hamano | 635530a | 2010-04-06 14:48:55 -0700 | [diff] [blame] | 799 | git log --oneline >actual && |
Junio C Hamano | 4f62c2b | 2010-04-08 10:17:17 -0700 | [diff] [blame] | 800 | test_cmp expect.none actual && |
| 801 | git log --oneline --decorate >actual && |
| 802 | test_cmp expect.short actual && |
| 803 | git log --oneline --decorate=full >actual && |
| 804 | test_cmp expect.full actual && |
Junio C Hamano | 8a3d203 | 2010-02-17 10:20:49 -0800 | [diff] [blame] | 805 | |
Yann Droneaud | 90e76b7 | 2013-03-24 22:06:06 +0100 | [diff] [blame] | 806 | test_config log.decorate 1 && |
Jeff King | b2be2f6 | 2010-11-17 12:00:45 -0500 | [diff] [blame] | 807 | git log --oneline >actual && |
| 808 | test_cmp expect.short actual && |
| 809 | git log --oneline --decorate=full >actual && |
| 810 | test_cmp expect.full actual && |
| 811 | git log --oneline --decorate=no >actual && |
| 812 | test_cmp expect.none actual && |
| 813 | |
Yann Droneaud | 90e76b7 | 2013-03-24 22:06:06 +0100 | [diff] [blame] | 814 | test_config log.decorate short && |
Junio C Hamano | 635530a | 2010-04-06 14:48:55 -0700 | [diff] [blame] | 815 | git log --oneline >actual && |
Junio C Hamano | 4f62c2b | 2010-04-08 10:17:17 -0700 | [diff] [blame] | 816 | test_cmp expect.short actual && |
| 817 | git log --oneline --no-decorate >actual && |
| 818 | test_cmp expect.none actual && |
| 819 | git log --oneline --decorate=full >actual && |
| 820 | test_cmp expect.full actual && |
Junio C Hamano | 8a3d203 | 2010-02-17 10:20:49 -0800 | [diff] [blame] | 821 | |
Yann Droneaud | 90e76b7 | 2013-03-24 22:06:06 +0100 | [diff] [blame] | 822 | test_config log.decorate full && |
Junio C Hamano | 635530a | 2010-04-06 14:48:55 -0700 | [diff] [blame] | 823 | git log --oneline >actual && |
Junio C Hamano | 4f62c2b | 2010-04-08 10:17:17 -0700 | [diff] [blame] | 824 | test_cmp expect.full actual && |
| 825 | git log --oneline --no-decorate >actual && |
| 826 | test_cmp expect.none actual && |
| 827 | git log --oneline --decorate >actual && |
Jeff King | 8fb2687 | 2015-03-20 06:06:15 -0400 | [diff] [blame] | 828 | test_cmp expect.short actual && |
Junio C Hamano | 8a3d203 | 2010-02-17 10:20:49 -0800 | [diff] [blame] | 829 | |
Yann Droneaud | 90e76b7 | 2013-03-24 22:06:06 +0100 | [diff] [blame] | 830 | test_unconfig log.decorate && |
Jay Soffian | 0c47695 | 2011-05-18 13:56:04 -0400 | [diff] [blame] | 831 | git log --pretty=raw >expect.raw && |
Yann Droneaud | 90e76b7 | 2013-03-24 22:06:06 +0100 | [diff] [blame] | 832 | test_config log.decorate full && |
Jay Soffian | 0c47695 | 2011-05-18 13:56:04 -0400 | [diff] [blame] | 833 | git log --pretty=raw >actual && |
| 834 | test_cmp expect.raw actual |
| 835 | |
| 836 | ' |
| 837 | |
Ævar Arnfjörð Bjarmason | 1c7e239 | 2023-03-28 16:04:26 +0200 | [diff] [blame^] | 838 | test_expect_failure 'parse log.excludeDecoration with no value' ' |
| 839 | cp .git/config .git/config.orig && |
| 840 | test_when_finished mv .git/config.orig .git/config && |
| 841 | |
| 842 | cat >>.git/config <<-\EOF && |
| 843 | [log] |
| 844 | excludeDecoration |
| 845 | EOF |
| 846 | git log --decorate=short |
| 847 | ' |
| 848 | |
Rafael Ascensão | 65516f5 | 2017-11-21 21:33:41 +0000 | [diff] [blame] | 849 | test_expect_success 'decorate-refs with glob' ' |
| 850 | cat >expect.decorate <<-\EOF && |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 851 | Merge-tag-reach |
| 852 | Merge-tags-octopus-a-and-octopus-b |
Rafael Ascensão | 65516f5 | 2017-11-21 21:33:41 +0000 | [diff] [blame] | 853 | seventh |
| 854 | octopus-b (octopus-b) |
| 855 | octopus-a (octopus-a) |
| 856 | reach |
| 857 | EOF |
Derrick Stolee | a6be5e6 | 2020-04-16 14:15:49 +0000 | [diff] [blame] | 858 | cat >expect.no-decorate <<-\EOF && |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 859 | Merge-tag-reach |
| 860 | Merge-tags-octopus-a-and-octopus-b |
Derrick Stolee | a6be5e6 | 2020-04-16 14:15:49 +0000 | [diff] [blame] | 861 | seventh |
| 862 | octopus-b |
| 863 | octopus-a |
| 864 | reach |
| 865 | EOF |
Rafael Ascensão | 65516f5 | 2017-11-21 21:33:41 +0000 | [diff] [blame] | 866 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ |
| 867 | --decorate-refs="heads/octopus*" >actual && |
Derrick Stolee | a6be5e6 | 2020-04-16 14:15:49 +0000 | [diff] [blame] | 868 | test_cmp expect.decorate actual && |
| 869 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ |
| 870 | --decorate-refs-exclude="heads/octopus*" \ |
| 871 | --decorate-refs="heads/octopus*" >actual && |
| 872 | test_cmp expect.no-decorate actual && |
| 873 | git -c log.excludeDecoration="heads/octopus*" log \ |
| 874 | -n6 --decorate=short --pretty="tformat:%f%d" \ |
| 875 | --decorate-refs="heads/octopus*" >actual && |
Rafael Ascensão | 65516f5 | 2017-11-21 21:33:41 +0000 | [diff] [blame] | 876 | test_cmp expect.decorate actual |
| 877 | ' |
| 878 | |
| 879 | test_expect_success 'decorate-refs without globs' ' |
| 880 | cat >expect.decorate <<-\EOF && |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 881 | Merge-tag-reach |
| 882 | Merge-tags-octopus-a-and-octopus-b |
Rafael Ascensão | 65516f5 | 2017-11-21 21:33:41 +0000 | [diff] [blame] | 883 | seventh |
| 884 | octopus-b |
| 885 | octopus-a |
| 886 | reach (tag: reach) |
| 887 | EOF |
| 888 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ |
| 889 | --decorate-refs="tags/reach" >actual && |
| 890 | test_cmp expect.decorate actual |
| 891 | ' |
| 892 | |
| 893 | test_expect_success 'multiple decorate-refs' ' |
| 894 | cat >expect.decorate <<-\EOF && |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 895 | Merge-tag-reach |
| 896 | Merge-tags-octopus-a-and-octopus-b |
Rafael Ascensão | 65516f5 | 2017-11-21 21:33:41 +0000 | [diff] [blame] | 897 | seventh |
| 898 | octopus-b (octopus-b) |
| 899 | octopus-a (octopus-a) |
| 900 | reach (tag: reach) |
| 901 | EOF |
| 902 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ |
| 903 | --decorate-refs="heads/octopus*" \ |
| 904 | --decorate-refs="tags/reach" >actual && |
| 905 | test_cmp expect.decorate actual |
| 906 | ' |
| 907 | |
| 908 | test_expect_success 'decorate-refs-exclude with glob' ' |
| 909 | cat >expect.decorate <<-\EOF && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 910 | Merge-tag-reach (HEAD -> main) |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 911 | Merge-tags-octopus-a-and-octopus-b |
Rafael Ascensão | 65516f5 | 2017-11-21 21:33:41 +0000 | [diff] [blame] | 912 | seventh (tag: seventh) |
| 913 | octopus-b (tag: octopus-b) |
| 914 | octopus-a (tag: octopus-a) |
| 915 | reach (tag: reach, reach) |
| 916 | EOF |
| 917 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ |
| 918 | --decorate-refs-exclude="heads/octopus*" >actual && |
Derrick Stolee | a6be5e6 | 2020-04-16 14:15:49 +0000 | [diff] [blame] | 919 | test_cmp expect.decorate actual && |
| 920 | git -c log.excludeDecoration="heads/octopus*" log \ |
| 921 | -n6 --decorate=short --pretty="tformat:%f%d" >actual && |
Rafael Ascensão | 65516f5 | 2017-11-21 21:33:41 +0000 | [diff] [blame] | 922 | test_cmp expect.decorate actual |
| 923 | ' |
| 924 | |
| 925 | test_expect_success 'decorate-refs-exclude without globs' ' |
| 926 | cat >expect.decorate <<-\EOF && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 927 | Merge-tag-reach (HEAD -> main) |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 928 | Merge-tags-octopus-a-and-octopus-b |
Rafael Ascensão | 65516f5 | 2017-11-21 21:33:41 +0000 | [diff] [blame] | 929 | seventh (tag: seventh) |
| 930 | octopus-b (tag: octopus-b, octopus-b) |
| 931 | octopus-a (tag: octopus-a, octopus-a) |
| 932 | reach (reach) |
| 933 | EOF |
| 934 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ |
| 935 | --decorate-refs-exclude="tags/reach" >actual && |
Derrick Stolee | a6be5e6 | 2020-04-16 14:15:49 +0000 | [diff] [blame] | 936 | test_cmp expect.decorate actual && |
| 937 | git -c log.excludeDecoration="tags/reach" log \ |
| 938 | -n6 --decorate=short --pretty="tformat:%f%d" >actual && |
Rafael Ascensão | 65516f5 | 2017-11-21 21:33:41 +0000 | [diff] [blame] | 939 | test_cmp expect.decorate actual |
| 940 | ' |
| 941 | |
| 942 | test_expect_success 'multiple decorate-refs-exclude' ' |
| 943 | cat >expect.decorate <<-\EOF && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 944 | Merge-tag-reach (HEAD -> main) |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 945 | Merge-tags-octopus-a-and-octopus-b |
Rafael Ascensão | 65516f5 | 2017-11-21 21:33:41 +0000 | [diff] [blame] | 946 | seventh (tag: seventh) |
| 947 | octopus-b (tag: octopus-b) |
| 948 | octopus-a (tag: octopus-a) |
| 949 | reach (reach) |
| 950 | EOF |
| 951 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ |
| 952 | --decorate-refs-exclude="heads/octopus*" \ |
| 953 | --decorate-refs-exclude="tags/reach" >actual && |
Derrick Stolee | a6be5e6 | 2020-04-16 14:15:49 +0000 | [diff] [blame] | 954 | test_cmp expect.decorate actual && |
| 955 | git -c log.excludeDecoration="heads/octopus*" \ |
| 956 | -c log.excludeDecoration="tags/reach" log \ |
| 957 | -n6 --decorate=short --pretty="tformat:%f%d" >actual && |
| 958 | test_cmp expect.decorate actual && |
| 959 | git -c log.excludeDecoration="heads/octopus*" log \ |
| 960 | --decorate-refs-exclude="tags/reach" \ |
| 961 | -n6 --decorate=short --pretty="tformat:%f%d" >actual && |
Rafael Ascensão | 65516f5 | 2017-11-21 21:33:41 +0000 | [diff] [blame] | 962 | test_cmp expect.decorate actual |
| 963 | ' |
| 964 | |
| 965 | test_expect_success 'decorate-refs and decorate-refs-exclude' ' |
Derrick Stolee | a6be5e6 | 2020-04-16 14:15:49 +0000 | [diff] [blame] | 966 | cat >expect.no-decorate <<-\EOF && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 967 | Merge-tag-reach (main) |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 968 | Merge-tags-octopus-a-and-octopus-b |
Rafael Ascensão | 65516f5 | 2017-11-21 21:33:41 +0000 | [diff] [blame] | 969 | seventh |
| 970 | octopus-b |
| 971 | octopus-a |
| 972 | reach (reach) |
| 973 | EOF |
| 974 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ |
| 975 | --decorate-refs="heads/*" \ |
| 976 | --decorate-refs-exclude="heads/oc*" >actual && |
Derrick Stolee | a6be5e6 | 2020-04-16 14:15:49 +0000 | [diff] [blame] | 977 | test_cmp expect.no-decorate actual |
| 978 | ' |
| 979 | |
| 980 | test_expect_success 'deocrate-refs and log.excludeDecoration' ' |
| 981 | cat >expect.decorate <<-\EOF && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 982 | Merge-tag-reach (main) |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 983 | Merge-tags-octopus-a-and-octopus-b |
Derrick Stolee | a6be5e6 | 2020-04-16 14:15:49 +0000 | [diff] [blame] | 984 | seventh |
| 985 | octopus-b (octopus-b) |
| 986 | octopus-a (octopus-a) |
| 987 | reach (reach) |
| 988 | EOF |
| 989 | git -c log.excludeDecoration="heads/oc*" log \ |
| 990 | --decorate-refs="heads/*" \ |
| 991 | -n6 --decorate=short --pretty="tformat:%f%d" >actual && |
Rafael Ascensão | 65516f5 | 2017-11-21 21:33:41 +0000 | [diff] [blame] | 992 | test_cmp expect.decorate actual |
| 993 | ' |
| 994 | |
René Scharfe | 0cc7380 | 2019-09-08 19:58:51 +0200 | [diff] [blame] | 995 | test_expect_success 'decorate-refs-exclude and simplify-by-decoration' ' |
René Scharfe | b4ecbcf | 2019-09-08 19:58:41 +0200 | [diff] [blame] | 996 | cat >expect.decorate <<-\EOF && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 997 | Merge-tag-reach (HEAD -> main) |
René Scharfe | b4ecbcf | 2019-09-08 19:58:41 +0200 | [diff] [blame] | 998 | reach (tag: reach, reach) |
| 999 | seventh (tag: seventh) |
Derrick Stolee | 748706d | 2022-08-05 17:58:40 +0000 | [diff] [blame] | 1000 | Merge-branch-tangle (refs/hidden/tangle) |
| 1001 | Merge-branch-side-early-part-into-tangle (refs/rewritten/merge, tangle) |
| 1002 | Merge-branch-main-early-part-into-tangle (refs/prefetch/merge) |
René Scharfe | b4ecbcf | 2019-09-08 19:58:41 +0200 | [diff] [blame] | 1003 | EOF |
| 1004 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ |
| 1005 | --decorate-refs-exclude="*octopus*" \ |
| 1006 | --simplify-by-decoration >actual && |
Derrick Stolee | a6be5e6 | 2020-04-16 14:15:49 +0000 | [diff] [blame] | 1007 | test_cmp expect.decorate actual && |
| 1008 | git -c log.excludeDecoration="*octopus*" log \ |
| 1009 | -n6 --decorate=short --pretty="tformat:%f%d" \ |
| 1010 | --simplify-by-decoration >actual && |
René Scharfe | b4ecbcf | 2019-09-08 19:58:41 +0200 | [diff] [blame] | 1011 | test_cmp expect.decorate actual |
| 1012 | ' |
| 1013 | |
Jeff King | 14b9c2b | 2021-12-02 00:35:43 -0500 | [diff] [blame] | 1014 | test_expect_success 'decorate-refs with implied decorate from format' ' |
| 1015 | cat >expect <<-\EOF && |
| 1016 | side-2 (tag: side-2) |
| 1017 | side-1 |
| 1018 | EOF |
| 1019 | git log --no-walk --format="%s%d" \ |
| 1020 | --decorate-refs="*side-2" side-1 side-2 \ |
| 1021 | >actual && |
| 1022 | test_cmp expect actual |
| 1023 | ' |
| 1024 | |
| 1025 | test_expect_success 'implied decorate does not override option' ' |
| 1026 | cat >expect <<-\EOF && |
| 1027 | side-2 (tag: refs/tags/side-2, refs/heads/side) |
| 1028 | side-1 (tag: refs/tags/side-1) |
| 1029 | EOF |
| 1030 | git log --no-walk --format="%s%d" \ |
| 1031 | --decorate=full side-1 side-2 \ |
| 1032 | >actual && |
| 1033 | test_cmp expect actual |
| 1034 | ' |
| 1035 | |
Jeff King | be73860 | 2021-12-02 00:37:53 -0500 | [diff] [blame] | 1036 | test_expect_success 'decorate-refs and simplify-by-decoration without output' ' |
| 1037 | cat >expect <<-\EOF && |
| 1038 | side-2 |
| 1039 | initial |
| 1040 | EOF |
| 1041 | # Do not just use a --format without %d here; we want to |
| 1042 | # make sure that we did not accidentally turn on displaying |
| 1043 | # the decorations, too. And that requires one of the regular |
| 1044 | # formats. |
| 1045 | git log --decorate-refs="*side-2" --oneline \ |
| 1046 | --simplify-by-decoration >actual.raw && |
| 1047 | sed "s/^[0-9a-f]* //" <actual.raw >actual && |
| 1048 | test_cmp expect actual |
| 1049 | ' |
| 1050 | |
Derrick Stolee | b877e61 | 2022-08-05 17:58:33 +0000 | [diff] [blame] | 1051 | test_expect_success 'decorate-refs-exclude HEAD' ' |
| 1052 | git log --decorate=full --oneline \ |
| 1053 | --decorate-refs-exclude="HEAD" >actual && |
| 1054 | ! grep HEAD actual |
| 1055 | ' |
| 1056 | |
Derrick Stolee | 9215629 | 2022-08-05 17:58:39 +0000 | [diff] [blame] | 1057 | test_expect_success 'decorate-refs focus from default' ' |
| 1058 | git log --decorate=full --oneline \ |
| 1059 | --decorate-refs="refs/heads" >actual && |
| 1060 | ! grep HEAD actual |
| 1061 | ' |
| 1062 | |
Derrick Stolee | 748706d | 2022-08-05 17:58:40 +0000 | [diff] [blame] | 1063 | test_expect_success '--clear-decorations overrides defaults' ' |
| 1064 | cat >expect.default <<-\EOF && |
| 1065 | Merge-tag-reach (HEAD -> refs/heads/main) |
| 1066 | Merge-tags-octopus-a-and-octopus-b |
| 1067 | seventh (tag: refs/tags/seventh) |
| 1068 | octopus-b (tag: refs/tags/octopus-b, refs/heads/octopus-b) |
| 1069 | octopus-a (tag: refs/tags/octopus-a, refs/heads/octopus-a) |
| 1070 | reach (tag: refs/tags/reach, refs/heads/reach) |
| 1071 | Merge-branch-tangle |
| 1072 | Merge-branch-side-early-part-into-tangle (refs/heads/tangle) |
| 1073 | Merge-branch-main-early-part-into-tangle |
| 1074 | tangle-a (tag: refs/tags/tangle-a) |
| 1075 | Merge-branch-side |
| 1076 | side-2 (tag: refs/tags/side-2, refs/heads/side) |
| 1077 | side-1 (tag: refs/tags/side-1) |
| 1078 | Second |
| 1079 | sixth |
| 1080 | fifth |
| 1081 | fourth |
| 1082 | third |
| 1083 | second |
| 1084 | initial |
| 1085 | EOF |
| 1086 | git log --decorate=full --pretty="tformat:%f%d" >actual && |
| 1087 | test_cmp expect.default actual && |
| 1088 | |
| 1089 | cat >expect.all <<-\EOF && |
| 1090 | Merge-tag-reach (HEAD -> refs/heads/main) |
| 1091 | Merge-tags-octopus-a-and-octopus-b |
| 1092 | seventh (tag: refs/tags/seventh) |
| 1093 | octopus-b (tag: refs/tags/octopus-b, refs/heads/octopus-b) |
| 1094 | octopus-a (tag: refs/tags/octopus-a, refs/heads/octopus-a) |
| 1095 | reach (tag: refs/tags/reach, refs/heads/reach) |
| 1096 | Merge-branch-tangle (refs/hidden/tangle) |
| 1097 | Merge-branch-side-early-part-into-tangle (refs/rewritten/merge, refs/heads/tangle) |
| 1098 | Merge-branch-main-early-part-into-tangle (refs/prefetch/merge) |
| 1099 | tangle-a (tag: refs/tags/tangle-a) |
| 1100 | Merge-branch-side |
| 1101 | side-2 (tag: refs/tags/side-2, refs/heads/side) |
| 1102 | side-1 (tag: refs/tags/side-1) |
| 1103 | Second |
| 1104 | sixth |
| 1105 | fifth |
| 1106 | fourth |
| 1107 | third |
| 1108 | second |
| 1109 | initial |
| 1110 | EOF |
| 1111 | git log --decorate=full --pretty="tformat:%f%d" \ |
| 1112 | --clear-decorations >actual && |
Derrick Stolee | 3e103ed | 2022-08-05 17:58:41 +0000 | [diff] [blame] | 1113 | test_cmp expect.all actual && |
| 1114 | git -c log.initialDecorationSet=all log \ |
| 1115 | --decorate=full --pretty="tformat:%f%d" >actual && |
Derrick Stolee | 748706d | 2022-08-05 17:58:40 +0000 | [diff] [blame] | 1116 | test_cmp expect.all actual |
| 1117 | ' |
| 1118 | |
| 1119 | test_expect_success '--clear-decorations clears previous exclusions' ' |
| 1120 | cat >expect.all <<-\EOF && |
| 1121 | Merge-tag-reach (HEAD -> refs/heads/main) |
| 1122 | reach (tag: refs/tags/reach, refs/heads/reach) |
| 1123 | Merge-tags-octopus-a-and-octopus-b |
| 1124 | octopus-b (tag: refs/tags/octopus-b, refs/heads/octopus-b) |
| 1125 | octopus-a (tag: refs/tags/octopus-a, refs/heads/octopus-a) |
| 1126 | seventh (tag: refs/tags/seventh) |
| 1127 | Merge-branch-tangle (refs/hidden/tangle) |
| 1128 | Merge-branch-side-early-part-into-tangle (refs/rewritten/merge, refs/heads/tangle) |
| 1129 | Merge-branch-main-early-part-into-tangle (refs/prefetch/merge) |
| 1130 | tangle-a (tag: refs/tags/tangle-a) |
| 1131 | side-2 (tag: refs/tags/side-2, refs/heads/side) |
| 1132 | side-1 (tag: refs/tags/side-1) |
| 1133 | initial |
| 1134 | EOF |
| 1135 | |
| 1136 | git log --decorate=full --pretty="tformat:%f%d" \ |
| 1137 | --simplify-by-decoration \ |
| 1138 | --decorate-refs-exclude="heads/octopus*" \ |
| 1139 | --decorate-refs="heads" \ |
| 1140 | --clear-decorations >actual && |
| 1141 | test_cmp expect.all actual && |
| 1142 | |
| 1143 | cat >expect.filtered <<-\EOF && |
| 1144 | Merge-tags-octopus-a-and-octopus-b |
| 1145 | octopus-b (refs/heads/octopus-b) |
| 1146 | octopus-a (refs/heads/octopus-a) |
| 1147 | initial |
| 1148 | EOF |
| 1149 | |
| 1150 | git log --decorate=full --pretty="tformat:%f%d" \ |
| 1151 | --simplify-by-decoration \ |
| 1152 | --decorate-refs-exclude="heads/octopus" \ |
| 1153 | --decorate-refs="heads" \ |
| 1154 | --clear-decorations \ |
| 1155 | --decorate-refs-exclude="tags/" \ |
| 1156 | --decorate-refs="heads/octopus*" >actual && |
| 1157 | test_cmp expect.filtered actual |
| 1158 | ' |
| 1159 | |
brian m. carlson | c74271a | 2017-05-14 18:00:58 +0000 | [diff] [blame] | 1160 | test_expect_success 'log.decorate config parsing' ' |
| 1161 | git log --oneline --decorate=full >expect.full && |
| 1162 | git log --oneline --decorate=short >expect.short && |
| 1163 | |
| 1164 | test_config log.decorate full && |
| 1165 | test_config log.mailmap true && |
| 1166 | git log --oneline >actual && |
| 1167 | test_cmp expect.full actual && |
| 1168 | git log --oneline --decorate=short >actual && |
| 1169 | test_cmp expect.short actual |
| 1170 | ' |
| 1171 | |
Alex Henrie | 940a911 | 2017-03-23 23:46:31 -0600 | [diff] [blame] | 1172 | test_expect_success TTY 'log output on a TTY' ' |
Jeff King | e433749 | 2017-10-03 09:39:34 -0400 | [diff] [blame] | 1173 | git log --color --oneline --decorate >expect.short && |
Alex Henrie | 940a911 | 2017-03-23 23:46:31 -0600 | [diff] [blame] | 1174 | |
| 1175 | test_terminal git log --oneline >actual && |
| 1176 | test_cmp expect.short actual |
| 1177 | ' |
| 1178 | |
Jay Soffian | 0c47695 | 2011-05-18 13:56:04 -0400 | [diff] [blame] | 1179 | test_expect_success 'reflog is expected format' ' |
Jay Soffian | 0c47695 | 2011-05-18 13:56:04 -0400 | [diff] [blame] | 1180 | git log -g --abbrev-commit --pretty=oneline >expect && |
| 1181 | git reflog >actual && |
| 1182 | test_cmp expect actual |
| 1183 | ' |
| 1184 | |
| 1185 | test_expect_success 'whatchanged is expected format' ' |
| 1186 | git log --no-merges --raw >expect && |
| 1187 | git whatchanged >actual && |
| 1188 | test_cmp expect actual |
| 1189 | ' |
| 1190 | |
| 1191 | test_expect_success 'log.abbrevCommit configuration' ' |
Jay Soffian | 0c47695 | 2011-05-18 13:56:04 -0400 | [diff] [blame] | 1192 | git log --abbrev-commit >expect.log.abbrev && |
| 1193 | git log --no-abbrev-commit >expect.log.full && |
| 1194 | git log --pretty=raw >expect.log.raw && |
| 1195 | git reflog --abbrev-commit >expect.reflog.abbrev && |
| 1196 | git reflog --no-abbrev-commit >expect.reflog.full && |
| 1197 | git whatchanged --abbrev-commit >expect.whatchanged.abbrev && |
| 1198 | git whatchanged --no-abbrev-commit >expect.whatchanged.full && |
| 1199 | |
Yann Droneaud | 90e76b7 | 2013-03-24 22:06:06 +0100 | [diff] [blame] | 1200 | test_config log.abbrevCommit true && |
Jay Soffian | 0c47695 | 2011-05-18 13:56:04 -0400 | [diff] [blame] | 1201 | |
| 1202 | git log >actual && |
| 1203 | test_cmp expect.log.abbrev actual && |
| 1204 | git log --no-abbrev-commit >actual && |
| 1205 | test_cmp expect.log.full actual && |
| 1206 | |
| 1207 | git log --pretty=raw >actual && |
| 1208 | test_cmp expect.log.raw actual && |
| 1209 | |
| 1210 | git reflog >actual && |
| 1211 | test_cmp expect.reflog.abbrev actual && |
| 1212 | git reflog --no-abbrev-commit >actual && |
| 1213 | test_cmp expect.reflog.full actual && |
| 1214 | |
| 1215 | git whatchanged >actual && |
| 1216 | test_cmp expect.whatchanged.abbrev actual && |
| 1217 | git whatchanged --no-abbrev-commit >actual && |
| 1218 | test_cmp expect.whatchanged.full actual |
Junio C Hamano | 8a3d203 | 2010-02-17 10:20:49 -0800 | [diff] [blame] | 1219 | ' |
| 1220 | |
Ævar Arnfjörð Bjarmason | 6511312 | 2010-08-15 10:16:25 +0000 | [diff] [blame] | 1221 | test_expect_success 'show added path under "--follow -M"' ' |
| 1222 | # This tests for a regression introduced in v1.7.2-rc0~103^2~2 |
| 1223 | test_create_repo regression && |
| 1224 | ( |
| 1225 | cd regression && |
| 1226 | test_commit needs-another-commit && |
| 1227 | test_commit foo.bar && |
| 1228 | git log -M --follow -p foo.bar.t && |
| 1229 | git log -M --follow --stat foo.bar.t && |
| 1230 | git log -M --follow --name-only foo.bar.t |
| 1231 | ) |
| 1232 | ' |
Brandon Casey | c65233f | 2008-07-22 16:23:31 -0500 | [diff] [blame] | 1233 | |
Clemens Buchacher | 46ec510 | 2013-05-28 00:49:57 +0200 | [diff] [blame] | 1234 | test_expect_success 'git log -c --follow' ' |
| 1235 | test_create_repo follow-c && |
| 1236 | ( |
| 1237 | cd follow-c && |
| 1238 | test_commit initial file original && |
| 1239 | git rm file && |
| 1240 | test_commit rename file2 original && |
| 1241 | git reset --hard initial && |
| 1242 | test_commit modify file foo && |
| 1243 | git merge -m merge rename && |
| 1244 | git log -c --follow file2 |
| 1245 | ) |
| 1246 | ' |
| 1247 | |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1248 | cat >expect <<\EOF |
| 1249 | * commit COMMIT_OBJECT_NAME |
| 1250 | |\ Merge: MERGE_PARENTS |
| 1251 | | | Author: A U Thor <author@example.com> |
| 1252 | | | |
| 1253 | | | Merge HEADS DESCRIPTION |
| 1254 | | | |
| 1255 | | * commit COMMIT_OBJECT_NAME |
| 1256 | | | Author: A U Thor <author@example.com> |
| 1257 | | | |
| 1258 | | | reach |
| 1259 | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1260 | | | reach.t | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1261 | | | 1 file changed, 1 insertion(+) |
| 1262 | | | |
| 1263 | | | diff --git a/reach.t b/reach.t |
| 1264 | | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1265 | | | index BEFORE..AFTER |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1266 | | | --- /dev/null |
| 1267 | | | +++ b/reach.t |
| 1268 | | | @@ -0,0 +1 @@ |
| 1269 | | | +reach |
| 1270 | | | |
| 1271 | | \ |
| 1272 | *-. \ commit COMMIT_OBJECT_NAME |
| 1273 | |\ \ \ Merge: MERGE_PARENTS |
| 1274 | | | | | Author: A U Thor <author@example.com> |
| 1275 | | | | | |
| 1276 | | | | | Merge HEADS DESCRIPTION |
| 1277 | | | | | |
| 1278 | | | * | commit COMMIT_OBJECT_NAME |
| 1279 | | | |/ Author: A U Thor <author@example.com> |
| 1280 | | | | |
| 1281 | | | | octopus-b |
| 1282 | | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1283 | | | | octopus-b.t | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1284 | | | | 1 file changed, 1 insertion(+) |
| 1285 | | | | |
| 1286 | | | | diff --git a/octopus-b.t b/octopus-b.t |
| 1287 | | | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1288 | | | | index BEFORE..AFTER |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1289 | | | | --- /dev/null |
| 1290 | | | | +++ b/octopus-b.t |
| 1291 | | | | @@ -0,0 +1 @@ |
| 1292 | | | | +octopus-b |
| 1293 | | | | |
| 1294 | | * | commit COMMIT_OBJECT_NAME |
| 1295 | | |/ Author: A U Thor <author@example.com> |
| 1296 | | | |
| 1297 | | | octopus-a |
| 1298 | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1299 | | | octopus-a.t | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1300 | | | 1 file changed, 1 insertion(+) |
| 1301 | | | |
| 1302 | | | diff --git a/octopus-a.t b/octopus-a.t |
| 1303 | | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1304 | | | index BEFORE..AFTER |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1305 | | | --- /dev/null |
| 1306 | | | +++ b/octopus-a.t |
| 1307 | | | @@ -0,0 +1 @@ |
| 1308 | | | +octopus-a |
| 1309 | | | |
| 1310 | * | commit COMMIT_OBJECT_NAME |
| 1311 | |/ Author: A U Thor <author@example.com> |
| 1312 | | |
| 1313 | | seventh |
| 1314 | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1315 | | seventh.t | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1316 | | 1 file changed, 1 insertion(+) |
| 1317 | | |
| 1318 | | diff --git a/seventh.t b/seventh.t |
| 1319 | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1320 | | index BEFORE..AFTER |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1321 | | --- /dev/null |
| 1322 | | +++ b/seventh.t |
| 1323 | | @@ -0,0 +1 @@ |
| 1324 | | +seventh |
| 1325 | | |
| 1326 | * commit COMMIT_OBJECT_NAME |
| 1327 | |\ Merge: MERGE_PARENTS |
| 1328 | | | Author: A U Thor <author@example.com> |
| 1329 | | | |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 1330 | | | Merge branch 'tangle' |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1331 | | | |
| 1332 | | * commit COMMIT_OBJECT_NAME |
| 1333 | | |\ Merge: MERGE_PARENTS |
| 1334 | | | | Author: A U Thor <author@example.com> |
| 1335 | | | | |
| 1336 | | | | Merge branch 'side' (early part) into tangle |
| 1337 | | | | |
| 1338 | | * | commit COMMIT_OBJECT_NAME |
| 1339 | | |\ \ Merge: MERGE_PARENTS |
| 1340 | | | | | Author: A U Thor <author@example.com> |
| 1341 | | | | | |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 1342 | | | | | Merge branch 'main' (early part) into tangle |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1343 | | | | | |
| 1344 | | * | | commit COMMIT_OBJECT_NAME |
| 1345 | | | | | Author: A U Thor <author@example.com> |
| 1346 | | | | | |
| 1347 | | | | | tangle-a |
| 1348 | | | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1349 | | | | | tangle-a | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1350 | | | | | 1 file changed, 1 insertion(+) |
| 1351 | | | | | |
| 1352 | | | | | diff --git a/tangle-a b/tangle-a |
| 1353 | | | | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1354 | | | | | index BEFORE..AFTER |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1355 | | | | | --- /dev/null |
| 1356 | | | | | +++ b/tangle-a |
| 1357 | | | | | @@ -0,0 +1 @@ |
| 1358 | | | | | +a |
| 1359 | | | | | |
| 1360 | * | | | commit COMMIT_OBJECT_NAME |
| 1361 | |\ \ \ \ Merge: MERGE_PARENTS |
| 1362 | | | | | | Author: A U Thor <author@example.com> |
| 1363 | | | | | | |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 1364 | | | | | | Merge branch 'side' |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1365 | | | | | | |
| 1366 | | * | | | commit COMMIT_OBJECT_NAME |
| 1367 | | | |_|/ Author: A U Thor <author@example.com> |
| 1368 | | |/| | |
| 1369 | | | | | side-2 |
| 1370 | | | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1371 | | | | | 2 | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1372 | | | | | 1 file changed, 1 insertion(+) |
| 1373 | | | | | |
| 1374 | | | | | diff --git a/2 b/2 |
| 1375 | | | | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1376 | | | | | index BEFORE..AFTER |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1377 | | | | | --- /dev/null |
| 1378 | | | | | +++ b/2 |
| 1379 | | | | | @@ -0,0 +1 @@ |
| 1380 | | | | | +2 |
| 1381 | | | | | |
| 1382 | | * | | commit COMMIT_OBJECT_NAME |
| 1383 | | | | | Author: A U Thor <author@example.com> |
| 1384 | | | | | |
| 1385 | | | | | side-1 |
| 1386 | | | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1387 | | | | | 1 | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1388 | | | | | 1 file changed, 1 insertion(+) |
| 1389 | | | | | |
| 1390 | | | | | diff --git a/1 b/1 |
| 1391 | | | | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1392 | | | | | index BEFORE..AFTER |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1393 | | | | | --- /dev/null |
| 1394 | | | | | +++ b/1 |
| 1395 | | | | | @@ -0,0 +1 @@ |
| 1396 | | | | | +1 |
| 1397 | | | | | |
| 1398 | * | | | commit COMMIT_OBJECT_NAME |
| 1399 | | | | | Author: A U Thor <author@example.com> |
| 1400 | | | | | |
| 1401 | | | | | Second |
| 1402 | | | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1403 | | | | | one | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1404 | | | | | 1 file changed, 1 insertion(+) |
| 1405 | | | | | |
| 1406 | | | | | diff --git a/one b/one |
| 1407 | | | | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1408 | | | | | index BEFORE..AFTER |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1409 | | | | | --- /dev/null |
| 1410 | | | | | +++ b/one |
| 1411 | | | | | @@ -0,0 +1 @@ |
| 1412 | | | | | +case |
| 1413 | | | | | |
| 1414 | * | | | commit COMMIT_OBJECT_NAME |
| 1415 | | |_|/ Author: A U Thor <author@example.com> |
| 1416 | |/| | |
| 1417 | | | | sixth |
| 1418 | | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1419 | | | | a/two | 1 - |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1420 | | | | 1 file changed, 1 deletion(-) |
| 1421 | | | | |
| 1422 | | | | diff --git a/a/two b/a/two |
| 1423 | | | | deleted file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1424 | | | | index BEFORE..AFTER |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1425 | | | | --- a/a/two |
| 1426 | | | | +++ /dev/null |
| 1427 | | | | @@ -1 +0,0 @@ |
| 1428 | | | | -ni |
| 1429 | | | | |
| 1430 | * | | commit COMMIT_OBJECT_NAME |
| 1431 | | | | Author: A U Thor <author@example.com> |
| 1432 | | | | |
| 1433 | | | | fifth |
| 1434 | | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1435 | | | | a/two | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1436 | | | | 1 file changed, 1 insertion(+) |
| 1437 | | | | |
| 1438 | | | | diff --git a/a/two b/a/two |
| 1439 | | | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1440 | | | | index BEFORE..AFTER |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1441 | | | | --- /dev/null |
| 1442 | | | | +++ b/a/two |
| 1443 | | | | @@ -0,0 +1 @@ |
| 1444 | | | | +ni |
| 1445 | | | | |
| 1446 | * | | commit COMMIT_OBJECT_NAME |
| 1447 | |/ / Author: A U Thor <author@example.com> |
| 1448 | | | |
| 1449 | | | fourth |
| 1450 | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1451 | | | ein | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1452 | | | 1 file changed, 1 insertion(+) |
| 1453 | | | |
| 1454 | | | diff --git a/ein b/ein |
| 1455 | | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1456 | | | index BEFORE..AFTER |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1457 | | | --- /dev/null |
| 1458 | | | +++ b/ein |
| 1459 | | | @@ -0,0 +1 @@ |
| 1460 | | | +ichi |
| 1461 | | | |
| 1462 | * | commit COMMIT_OBJECT_NAME |
| 1463 | |/ Author: A U Thor <author@example.com> |
| 1464 | | |
| 1465 | | third |
| 1466 | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1467 | | ichi | 1 + |
| 1468 | | one | 1 - |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1469 | | 2 files changed, 1 insertion(+), 1 deletion(-) |
| 1470 | | |
| 1471 | | diff --git a/ichi b/ichi |
| 1472 | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1473 | | index BEFORE..AFTER |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1474 | | --- /dev/null |
| 1475 | | +++ b/ichi |
| 1476 | | @@ -0,0 +1 @@ |
| 1477 | | +ichi |
| 1478 | | diff --git a/one b/one |
| 1479 | | deleted file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1480 | | index BEFORE..AFTER |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1481 | | --- a/one |
| 1482 | | +++ /dev/null |
| 1483 | | @@ -1 +0,0 @@ |
| 1484 | | -ichi |
| 1485 | | |
| 1486 | * commit COMMIT_OBJECT_NAME |
| 1487 | | Author: A U Thor <author@example.com> |
| 1488 | | |
| 1489 | | second |
| 1490 | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1491 | | one | 2 +- |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1492 | | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 1493 | | |
| 1494 | | diff --git a/one b/one |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1495 | | index BEFORE..AFTER 100644 |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1496 | | --- a/one |
| 1497 | | +++ b/one |
| 1498 | | @@ -1 +1 @@ |
| 1499 | | -one |
| 1500 | | +ichi |
| 1501 | | |
| 1502 | * commit COMMIT_OBJECT_NAME |
| 1503 | Author: A U Thor <author@example.com> |
| 1504 | |
| 1505 | initial |
| 1506 | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1507 | one | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1508 | 1 file changed, 1 insertion(+) |
| 1509 | |
| 1510 | diff --git a/one b/one |
| 1511 | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1512 | index BEFORE..AFTER |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1513 | --- /dev/null |
| 1514 | +++ b/one |
| 1515 | @@ -0,0 +1 @@ |
| 1516 | +one |
| 1517 | EOF |
| 1518 | |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1519 | test_expect_success 'log --graph with diff and stats' ' |
Abhishek Kumar | 989eea9 | 2020-02-24 19:08:13 +0530 | [diff] [blame] | 1520 | lib_test_cmp_short_graph --no-renames --stat -p |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1521 | ' |
| 1522 | |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1523 | cat >expect <<\EOF |
| 1524 | *** * commit COMMIT_OBJECT_NAME |
| 1525 | *** |\ Merge: MERGE_PARENTS |
| 1526 | *** | | Author: A U Thor <author@example.com> |
| 1527 | *** | | |
| 1528 | *** | | Merge HEADS DESCRIPTION |
| 1529 | *** | | |
| 1530 | *** | * commit COMMIT_OBJECT_NAME |
| 1531 | *** | | Author: A U Thor <author@example.com> |
| 1532 | *** | | |
| 1533 | *** | | reach |
| 1534 | *** | | --- |
| 1535 | *** | | reach.t | 1 + |
| 1536 | *** | | 1 file changed, 1 insertion(+) |
| 1537 | *** | | |
| 1538 | *** | | diff --git a/reach.t b/reach.t |
| 1539 | *** | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1540 | *** | | index BEFORE..AFTER |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1541 | *** | | --- /dev/null |
| 1542 | *** | | +++ b/reach.t |
| 1543 | *** | | @@ -0,0 +1 @@ |
| 1544 | *** | | +reach |
| 1545 | *** | | |
| 1546 | *** | \ |
| 1547 | *** *-. \ commit COMMIT_OBJECT_NAME |
| 1548 | *** |\ \ \ Merge: MERGE_PARENTS |
| 1549 | *** | | | | Author: A U Thor <author@example.com> |
| 1550 | *** | | | | |
| 1551 | *** | | | | Merge HEADS DESCRIPTION |
| 1552 | *** | | | | |
| 1553 | *** | | * | commit COMMIT_OBJECT_NAME |
| 1554 | *** | | |/ Author: A U Thor <author@example.com> |
| 1555 | *** | | | |
| 1556 | *** | | | octopus-b |
| 1557 | *** | | | --- |
| 1558 | *** | | | octopus-b.t | 1 + |
| 1559 | *** | | | 1 file changed, 1 insertion(+) |
| 1560 | *** | | | |
| 1561 | *** | | | diff --git a/octopus-b.t b/octopus-b.t |
| 1562 | *** | | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1563 | *** | | | index BEFORE..AFTER |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1564 | *** | | | --- /dev/null |
| 1565 | *** | | | +++ b/octopus-b.t |
| 1566 | *** | | | @@ -0,0 +1 @@ |
| 1567 | *** | | | +octopus-b |
| 1568 | *** | | | |
| 1569 | *** | * | commit COMMIT_OBJECT_NAME |
| 1570 | *** | |/ Author: A U Thor <author@example.com> |
| 1571 | *** | | |
| 1572 | *** | | octopus-a |
| 1573 | *** | | --- |
| 1574 | *** | | octopus-a.t | 1 + |
| 1575 | *** | | 1 file changed, 1 insertion(+) |
| 1576 | *** | | |
| 1577 | *** | | diff --git a/octopus-a.t b/octopus-a.t |
| 1578 | *** | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1579 | *** | | index BEFORE..AFTER |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1580 | *** | | --- /dev/null |
| 1581 | *** | | +++ b/octopus-a.t |
| 1582 | *** | | @@ -0,0 +1 @@ |
| 1583 | *** | | +octopus-a |
| 1584 | *** | | |
| 1585 | *** * | commit COMMIT_OBJECT_NAME |
| 1586 | *** |/ Author: A U Thor <author@example.com> |
| 1587 | *** | |
| 1588 | *** | seventh |
| 1589 | *** | --- |
| 1590 | *** | seventh.t | 1 + |
| 1591 | *** | 1 file changed, 1 insertion(+) |
| 1592 | *** | |
| 1593 | *** | diff --git a/seventh.t b/seventh.t |
| 1594 | *** | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1595 | *** | index BEFORE..AFTER |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1596 | *** | --- /dev/null |
| 1597 | *** | +++ b/seventh.t |
| 1598 | *** | @@ -0,0 +1 @@ |
| 1599 | *** | +seventh |
| 1600 | *** | |
| 1601 | *** * commit COMMIT_OBJECT_NAME |
| 1602 | *** |\ Merge: MERGE_PARENTS |
| 1603 | *** | | Author: A U Thor <author@example.com> |
| 1604 | *** | | |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 1605 | *** | | Merge branch 'tangle' |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1606 | *** | | |
| 1607 | *** | * commit COMMIT_OBJECT_NAME |
| 1608 | *** | |\ Merge: MERGE_PARENTS |
| 1609 | *** | | | Author: A U Thor <author@example.com> |
| 1610 | *** | | | |
| 1611 | *** | | | Merge branch 'side' (early part) into tangle |
| 1612 | *** | | | |
| 1613 | *** | * | commit COMMIT_OBJECT_NAME |
| 1614 | *** | |\ \ Merge: MERGE_PARENTS |
| 1615 | *** | | | | Author: A U Thor <author@example.com> |
| 1616 | *** | | | | |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 1617 | *** | | | | Merge branch 'main' (early part) into tangle |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1618 | *** | | | | |
| 1619 | *** | * | | commit COMMIT_OBJECT_NAME |
| 1620 | *** | | | | Author: A U Thor <author@example.com> |
| 1621 | *** | | | | |
| 1622 | *** | | | | tangle-a |
| 1623 | *** | | | | --- |
| 1624 | *** | | | | tangle-a | 1 + |
| 1625 | *** | | | | 1 file changed, 1 insertion(+) |
| 1626 | *** | | | | |
| 1627 | *** | | | | diff --git a/tangle-a b/tangle-a |
| 1628 | *** | | | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1629 | *** | | | | index BEFORE..AFTER |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1630 | *** | | | | --- /dev/null |
| 1631 | *** | | | | +++ b/tangle-a |
| 1632 | *** | | | | @@ -0,0 +1 @@ |
| 1633 | *** | | | | +a |
| 1634 | *** | | | | |
| 1635 | *** * | | | commit COMMIT_OBJECT_NAME |
| 1636 | *** |\ \ \ \ Merge: MERGE_PARENTS |
| 1637 | *** | | | | | Author: A U Thor <author@example.com> |
| 1638 | *** | | | | | |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 1639 | *** | | | | | Merge branch 'side' |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1640 | *** | | | | | |
| 1641 | *** | * | | | commit COMMIT_OBJECT_NAME |
| 1642 | *** | | |_|/ Author: A U Thor <author@example.com> |
| 1643 | *** | |/| | |
| 1644 | *** | | | | side-2 |
| 1645 | *** | | | | --- |
| 1646 | *** | | | | 2 | 1 + |
| 1647 | *** | | | | 1 file changed, 1 insertion(+) |
| 1648 | *** | | | | |
| 1649 | *** | | | | diff --git a/2 b/2 |
| 1650 | *** | | | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1651 | *** | | | | index BEFORE..AFTER |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1652 | *** | | | | --- /dev/null |
| 1653 | *** | | | | +++ b/2 |
| 1654 | *** | | | | @@ -0,0 +1 @@ |
| 1655 | *** | | | | +2 |
| 1656 | *** | | | | |
| 1657 | *** | * | | commit COMMIT_OBJECT_NAME |
| 1658 | *** | | | | Author: A U Thor <author@example.com> |
| 1659 | *** | | | | |
| 1660 | *** | | | | side-1 |
| 1661 | *** | | | | --- |
| 1662 | *** | | | | 1 | 1 + |
| 1663 | *** | | | | 1 file changed, 1 insertion(+) |
| 1664 | *** | | | | |
| 1665 | *** | | | | diff --git a/1 b/1 |
| 1666 | *** | | | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1667 | *** | | | | index BEFORE..AFTER |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1668 | *** | | | | --- /dev/null |
| 1669 | *** | | | | +++ b/1 |
| 1670 | *** | | | | @@ -0,0 +1 @@ |
| 1671 | *** | | | | +1 |
| 1672 | *** | | | | |
| 1673 | *** * | | | commit COMMIT_OBJECT_NAME |
| 1674 | *** | | | | Author: A U Thor <author@example.com> |
| 1675 | *** | | | | |
| 1676 | *** | | | | Second |
| 1677 | *** | | | | --- |
| 1678 | *** | | | | one | 1 + |
| 1679 | *** | | | | 1 file changed, 1 insertion(+) |
| 1680 | *** | | | | |
| 1681 | *** | | | | diff --git a/one b/one |
| 1682 | *** | | | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1683 | *** | | | | index BEFORE..AFTER |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1684 | *** | | | | --- /dev/null |
| 1685 | *** | | | | +++ b/one |
| 1686 | *** | | | | @@ -0,0 +1 @@ |
| 1687 | *** | | | | +case |
| 1688 | *** | | | | |
| 1689 | *** * | | | commit COMMIT_OBJECT_NAME |
| 1690 | *** | |_|/ Author: A U Thor <author@example.com> |
| 1691 | *** |/| | |
| 1692 | *** | | | sixth |
| 1693 | *** | | | --- |
| 1694 | *** | | | a/two | 1 - |
| 1695 | *** | | | 1 file changed, 1 deletion(-) |
| 1696 | *** | | | |
| 1697 | *** | | | diff --git a/a/two b/a/two |
| 1698 | *** | | | deleted file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1699 | *** | | | index BEFORE..AFTER |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1700 | *** | | | --- a/a/two |
| 1701 | *** | | | +++ /dev/null |
| 1702 | *** | | | @@ -1 +0,0 @@ |
| 1703 | *** | | | -ni |
| 1704 | *** | | | |
| 1705 | *** * | | commit COMMIT_OBJECT_NAME |
| 1706 | *** | | | Author: A U Thor <author@example.com> |
| 1707 | *** | | | |
| 1708 | *** | | | fifth |
| 1709 | *** | | | --- |
| 1710 | *** | | | a/two | 1 + |
| 1711 | *** | | | 1 file changed, 1 insertion(+) |
| 1712 | *** | | | |
| 1713 | *** | | | diff --git a/a/two b/a/two |
| 1714 | *** | | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1715 | *** | | | index BEFORE..AFTER |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1716 | *** | | | --- /dev/null |
| 1717 | *** | | | +++ b/a/two |
| 1718 | *** | | | @@ -0,0 +1 @@ |
| 1719 | *** | | | +ni |
| 1720 | *** | | | |
| 1721 | *** * | | commit COMMIT_OBJECT_NAME |
| 1722 | *** |/ / Author: A U Thor <author@example.com> |
| 1723 | *** | | |
| 1724 | *** | | fourth |
| 1725 | *** | | --- |
| 1726 | *** | | ein | 1 + |
| 1727 | *** | | 1 file changed, 1 insertion(+) |
| 1728 | *** | | |
| 1729 | *** | | diff --git a/ein b/ein |
| 1730 | *** | | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1731 | *** | | index BEFORE..AFTER |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1732 | *** | | --- /dev/null |
| 1733 | *** | | +++ b/ein |
| 1734 | *** | | @@ -0,0 +1 @@ |
| 1735 | *** | | +ichi |
| 1736 | *** | | |
| 1737 | *** * | commit COMMIT_OBJECT_NAME |
| 1738 | *** |/ Author: A U Thor <author@example.com> |
| 1739 | *** | |
| 1740 | *** | third |
| 1741 | *** | --- |
| 1742 | *** | ichi | 1 + |
| 1743 | *** | one | 1 - |
| 1744 | *** | 2 files changed, 1 insertion(+), 1 deletion(-) |
| 1745 | *** | |
| 1746 | *** | diff --git a/ichi b/ichi |
| 1747 | *** | new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1748 | *** | index BEFORE..AFTER |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1749 | *** | --- /dev/null |
| 1750 | *** | +++ b/ichi |
| 1751 | *** | @@ -0,0 +1 @@ |
| 1752 | *** | +ichi |
| 1753 | *** | diff --git a/one b/one |
| 1754 | *** | deleted file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1755 | *** | index BEFORE..AFTER |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1756 | *** | --- a/one |
| 1757 | *** | +++ /dev/null |
| 1758 | *** | @@ -1 +0,0 @@ |
| 1759 | *** | -ichi |
| 1760 | *** | |
| 1761 | *** * commit COMMIT_OBJECT_NAME |
| 1762 | *** | Author: A U Thor <author@example.com> |
| 1763 | *** | |
| 1764 | *** | second |
| 1765 | *** | --- |
| 1766 | *** | one | 2 +- |
| 1767 | *** | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 1768 | *** | |
| 1769 | *** | diff --git a/one b/one |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1770 | *** | index BEFORE..AFTER 100644 |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1771 | *** | --- a/one |
| 1772 | *** | +++ b/one |
| 1773 | *** | @@ -1 +1 @@ |
| 1774 | *** | -one |
| 1775 | *** | +ichi |
| 1776 | *** | |
| 1777 | *** * commit COMMIT_OBJECT_NAME |
| 1778 | *** Author: A U Thor <author@example.com> |
| 1779 | *** |
| 1780 | *** initial |
| 1781 | *** --- |
| 1782 | *** one | 1 + |
| 1783 | *** 1 file changed, 1 insertion(+) |
| 1784 | *** |
| 1785 | *** diff --git a/one b/one |
| 1786 | *** new file mode 100644 |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 1787 | *** index BEFORE..AFTER |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1788 | *** --- /dev/null |
| 1789 | *** +++ b/one |
| 1790 | *** @@ -0,0 +1 @@ |
| 1791 | *** +one |
| 1792 | EOF |
| 1793 | |
| 1794 | test_expect_success 'log --line-prefix="*** " --graph with diff and stats' ' |
Abhishek Kumar | 989eea9 | 2020-02-24 19:08:13 +0530 | [diff] [blame] | 1795 | lib_test_cmp_short_graph --line-prefix="*** " --no-renames --stat -p |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1796 | ' |
| 1797 | |
Jeff King | f5022b5 | 2017-02-08 15:31:15 -0500 | [diff] [blame] | 1798 | cat >expect <<-\EOF |
| 1799 | * reach |
| 1800 | | |
| 1801 | | A reach.t |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 1802 | * Merge branch 'tangle' |
| 1803 | * Merge branch 'side' |
Jeff King | f5022b5 | 2017-02-08 15:31:15 -0500 | [diff] [blame] | 1804 | |\ |
| 1805 | | * side-2 |
| 1806 | | |
| 1807 | | A 2 |
| 1808 | * Second |
| 1809 | | |
| 1810 | | A one |
| 1811 | * sixth |
| 1812 | |
| 1813 | D a/two |
| 1814 | EOF |
| 1815 | |
| 1816 | test_expect_success 'log --graph with --name-status' ' |
Abhishek Kumar | 989eea9 | 2020-02-24 19:08:13 +0530 | [diff] [blame] | 1817 | test_cmp_graph --name-status tangle..reach |
Jeff King | f5022b5 | 2017-02-08 15:31:15 -0500 | [diff] [blame] | 1818 | ' |
| 1819 | |
| 1820 | cat >expect <<-\EOF |
| 1821 | * reach |
| 1822 | | |
| 1823 | | reach.t |
Junio C Hamano | 2153192 | 2020-07-30 10:06:42 -0700 | [diff] [blame] | 1824 | * Merge branch 'tangle' |
| 1825 | * Merge branch 'side' |
Jeff King | f5022b5 | 2017-02-08 15:31:15 -0500 | [diff] [blame] | 1826 | |\ |
| 1827 | | * side-2 |
| 1828 | | |
| 1829 | | 2 |
| 1830 | * Second |
| 1831 | | |
| 1832 | | one |
| 1833 | * sixth |
| 1834 | |
| 1835 | a/two |
| 1836 | EOF |
| 1837 | |
| 1838 | test_expect_success 'log --graph with --name-only' ' |
Abhishek Kumar | 989eea9 | 2020-02-24 19:08:13 +0530 | [diff] [blame] | 1839 | test_cmp_graph --name-only tangle..reach |
Jeff King | f5022b5 | 2017-02-08 15:31:15 -0500 | [diff] [blame] | 1840 | ' |
| 1841 | |
Alex Henrie | 087c745 | 2022-02-11 09:36:25 -0700 | [diff] [blame] | 1842 | test_expect_success '--no-graph countermands --graph' ' |
| 1843 | git log >expect && |
| 1844 | git log --graph --no-graph >actual && |
| 1845 | test_cmp expect actual |
| 1846 | ' |
| 1847 | |
| 1848 | test_expect_success '--graph countermands --no-graph' ' |
| 1849 | git log --graph >expect && |
| 1850 | git log --no-graph --graph >actual && |
| 1851 | test_cmp expect actual |
| 1852 | ' |
| 1853 | |
| 1854 | test_expect_success '--no-graph does not unset --topo-order' ' |
| 1855 | git log --topo-order >expect && |
| 1856 | git log --topo-order --no-graph >actual && |
| 1857 | test_cmp expect actual |
| 1858 | ' |
| 1859 | |
| 1860 | test_expect_success '--no-graph does not unset --parents' ' |
| 1861 | git log --parents >expect && |
| 1862 | git log --parents --no-graph >actual && |
| 1863 | test_cmp expect actual |
| 1864 | ' |
| 1865 | |
| 1866 | test_expect_success '--reverse and --graph conflict' ' |
| 1867 | test_must_fail git log --reverse --graph 2>stderr && |
| 1868 | test_i18ngrep "cannot be used together" stderr |
| 1869 | ' |
| 1870 | |
| 1871 | test_expect_success '--reverse --graph --no-graph works' ' |
| 1872 | git log --reverse >expect && |
| 1873 | git log --reverse --graph --no-graph >actual && |
| 1874 | test_cmp expect actual |
| 1875 | ' |
| 1876 | |
| 1877 | test_expect_success '--show-linear-break and --graph conflict' ' |
| 1878 | test_must_fail git log --show-linear-break --graph 2>stderr && |
| 1879 | test_i18ngrep "cannot be used together" stderr |
| 1880 | ' |
| 1881 | |
| 1882 | test_expect_success '--show-linear-break --graph --no-graph works' ' |
| 1883 | git log --show-linear-break >expect && |
| 1884 | git log --show-linear-break --graph --no-graph >actual && |
| 1885 | test_cmp expect actual |
| 1886 | ' |
| 1887 | |
| 1888 | test_expect_success '--no-walk and --graph conflict' ' |
| 1889 | test_must_fail git log --no-walk --graph 2>stderr && |
| 1890 | test_i18ngrep "cannot be used together" stderr |
| 1891 | ' |
| 1892 | |
| 1893 | test_expect_success '--no-walk --graph --no-graph works' ' |
| 1894 | git log --no-walk >expect && |
| 1895 | git log --no-walk --graph --no-graph >actual && |
| 1896 | test_cmp expect actual |
| 1897 | ' |
| 1898 | |
| 1899 | test_expect_success '--walk-reflogs and --graph conflict' ' |
| 1900 | test_must_fail git log --walk-reflogs --graph 2>stderr && |
| 1901 | (test_i18ngrep "cannot combine" stderr || |
| 1902 | test_i18ngrep "cannot be used together" stderr) |
| 1903 | ' |
| 1904 | |
| 1905 | test_expect_success '--walk-reflogs --graph --no-graph works' ' |
| 1906 | git log --walk-reflogs >expect && |
| 1907 | git log --walk-reflogs --graph --no-graph >actual && |
| 1908 | test_cmp expect actual |
| 1909 | ' |
| 1910 | |
Junio C Hamano | 003c84f | 2011-05-02 13:39:16 -0700 | [diff] [blame] | 1911 | test_expect_success 'dotdot is a parent directory' ' |
| 1912 | mkdir -p a/b && |
| 1913 | ( echo sixth && echo fifth ) >expect && |
| 1914 | ( cd a/b && git log --format=%s .. ) >actual && |
| 1915 | test_cmp expect actual |
| 1916 | ' |
| 1917 | |
Mehul Jain | aefc81a | 2016-06-24 19:42:34 +0530 | [diff] [blame] | 1918 | test_expect_success GPG 'setup signed branch' ' |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 1919 | test_when_finished "git reset --hard && git checkout main" && |
| 1920 | git checkout -b signed main && |
Zoltan Klinger | cf3983d | 2014-07-09 12:10:21 +1000 | [diff] [blame] | 1921 | echo foo >foo && |
| 1922 | git add foo && |
Mehul Jain | aefc81a | 2016-06-24 19:42:34 +0530 | [diff] [blame] | 1923 | git commit -S -m signed_commit |
| 1924 | ' |
| 1925 | |
Hans Jerry Illikainen | 67a6ea6 | 2019-11-22 20:23:12 +0000 | [diff] [blame] | 1926 | test_expect_success GPG 'setup signed branch with subkey' ' |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 1927 | test_when_finished "git reset --hard && git checkout main" && |
| 1928 | git checkout -b signed-subkey main && |
Hans Jerry Illikainen | 67a6ea6 | 2019-11-22 20:23:12 +0000 | [diff] [blame] | 1929 | echo foo >foo && |
| 1930 | git add foo && |
| 1931 | git commit -SB7227189 -m signed_commit |
| 1932 | ' |
| 1933 | |
Henning Schild | 53fc999 | 2018-07-20 10:28:07 +0200 | [diff] [blame] | 1934 | test_expect_success GPGSM 'setup signed branch x509' ' |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 1935 | test_when_finished "git reset --hard && git checkout main" && |
| 1936 | git checkout -b signed-x509 main && |
Henning Schild | 53fc999 | 2018-07-20 10:28:07 +0200 | [diff] [blame] | 1937 | echo foo >foo && |
| 1938 | git add foo && |
| 1939 | test_config gpg.format x509 && |
| 1940 | test_config user.signingkey $GIT_COMMITTER_EMAIL && |
| 1941 | git commit -S -m signed_commit |
| 1942 | ' |
| 1943 | |
Fabian Stelzer | f265f2d | 2021-09-10 20:07:41 +0000 | [diff] [blame] | 1944 | test_expect_success GPGSSH 'setup sshkey signed branch' ' |
| 1945 | test_config gpg.format ssh && |
| 1946 | test_config user.signingkey "${GPGSSH_KEY_PRIMARY}" && |
| 1947 | test_when_finished "git reset --hard && git checkout main" && |
| 1948 | git checkout -b signed-ssh main && |
| 1949 | echo foo >foo && |
| 1950 | git add foo && |
| 1951 | git commit -S -m signed_commit |
| 1952 | ' |
| 1953 | |
Fabian Stelzer | 4bbf378 | 2021-12-09 09:52:46 +0100 | [diff] [blame] | 1954 | test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'create signed commits with keys having defined lifetimes' ' |
| 1955 | test_config gpg.format ssh && |
| 1956 | touch file && |
| 1957 | git add file && |
| 1958 | |
| 1959 | echo expired >file && test_tick && git commit -a -m expired -S"${GPGSSH_KEY_EXPIRED}" && |
| 1960 | git tag expired-signed && |
| 1961 | |
| 1962 | echo notyetvalid >file && test_tick && git commit -a -m notyetvalid -S"${GPGSSH_KEY_NOTYETVALID}" && |
| 1963 | git tag notyetvalid-signed && |
| 1964 | |
| 1965 | echo timeboxedvalid >file && test_tick && git commit -a -m timeboxedvalid -S"${GPGSSH_KEY_TIMEBOXEDVALID}" && |
| 1966 | git tag timeboxedvalid-signed && |
| 1967 | |
| 1968 | echo timeboxedinvalid >file && test_tick && git commit -a -m timeboxedinvalid -S"${GPGSSH_KEY_TIMEBOXEDINVALID}" && |
| 1969 | git tag timeboxedinvalid-signed |
| 1970 | ' |
| 1971 | |
Hans Jerry Illikainen | 67a6ea6 | 2019-11-22 20:23:12 +0000 | [diff] [blame] | 1972 | test_expect_success GPGSM 'log x509 fingerprint' ' |
| 1973 | echo "F8BF62E0693D0694816377099909C779FA23FD65 | " >expect && |
| 1974 | git log -n1 --format="%GF | %GP" signed-x509 >actual && |
| 1975 | test_cmp expect actual |
| 1976 | ' |
| 1977 | |
| 1978 | test_expect_success GPGSM 'log OpenPGP fingerprint' ' |
| 1979 | echo "D4BE22311AD3131E5EDA29A461092E85B7227189" > expect && |
| 1980 | git log -n1 --format="%GP" signed-subkey >actual && |
| 1981 | test_cmp expect actual |
| 1982 | ' |
| 1983 | |
Fabian Stelzer | f265f2d | 2021-09-10 20:07:41 +0000 | [diff] [blame] | 1984 | test_expect_success GPGSSH 'log ssh key fingerprint' ' |
| 1985 | test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" && |
| 1986 | ssh-keygen -lf "${GPGSSH_KEY_PRIMARY}" | awk "{print \$2\" | \"}" >expect && |
| 1987 | git log -n1 --format="%GF | %GP" signed-ssh >actual && |
| 1988 | test_cmp expect actual |
| 1989 | ' |
| 1990 | |
Mehul Jain | aefc81a | 2016-06-24 19:42:34 +0530 | [diff] [blame] | 1991 | test_expect_success GPG 'log --graph --show-signature' ' |
Zoltan Klinger | cf3983d | 2014-07-09 12:10:21 +1000 | [diff] [blame] | 1992 | git log --graph --show-signature -n1 signed >actual && |
| 1993 | grep "^| gpg: Signature made" actual && |
| 1994 | grep "^| gpg: Good signature" actual |
| 1995 | ' |
| 1996 | |
Henning Schild | 53fc999 | 2018-07-20 10:28:07 +0200 | [diff] [blame] | 1997 | test_expect_success GPGSM 'log --graph --show-signature x509' ' |
| 1998 | git log --graph --show-signature -n1 signed-x509 >actual && |
| 1999 | grep "^| gpgsm: Signature made" actual && |
| 2000 | grep "^| gpgsm: Good signature" actual |
| 2001 | ' |
| 2002 | |
Fabian Stelzer | f265f2d | 2021-09-10 20:07:41 +0000 | [diff] [blame] | 2003 | test_expect_success GPGSSH 'log --graph --show-signature ssh' ' |
| 2004 | test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" && |
| 2005 | git log --graph --show-signature -n1 signed-ssh >actual && |
| 2006 | grep "${GOOD_SIGNATURE_TRUSTED}" actual |
| 2007 | ' |
| 2008 | |
Fabian Stelzer | 4bbf378 | 2021-12-09 09:52:46 +0100 | [diff] [blame] | 2009 | test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'log shows failure on expired signature key' ' |
| 2010 | test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" && |
| 2011 | git log --graph --show-signature -n1 expired-signed >actual && |
| 2012 | ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual |
| 2013 | ' |
| 2014 | |
| 2015 | test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'log shows failure on not yet valid signature key' ' |
| 2016 | test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" && |
| 2017 | git log --graph --show-signature -n1 notyetvalid-signed >actual && |
| 2018 | ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual |
| 2019 | ' |
| 2020 | |
| 2021 | test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'log show success with commit date and key validity matching' ' |
| 2022 | test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" && |
| 2023 | git log --graph --show-signature -n1 timeboxedvalid-signed >actual && |
| 2024 | grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual && |
| 2025 | ! grep "${GPGSSH_BAD_SIGNATURE}" actual |
| 2026 | ' |
| 2027 | |
| 2028 | test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'log shows failure with commit date outside of key validity' ' |
| 2029 | test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" && |
| 2030 | git log --graph --show-signature -n1 timeboxedinvalid-signed >actual && |
| 2031 | ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual |
| 2032 | ' |
| 2033 | |
Zoltan Klinger | cf3983d | 2014-07-09 12:10:21 +1000 | [diff] [blame] | 2034 | test_expect_success GPG 'log --graph --show-signature for merged tag' ' |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2035 | test_when_finished "git reset --hard && git checkout main" && |
| 2036 | git checkout -b plain main && |
Zoltan Klinger | cf3983d | 2014-07-09 12:10:21 +1000 | [diff] [blame] | 2037 | echo aaa >bar && |
| 2038 | git add bar && |
| 2039 | git commit -m bar_commit && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2040 | git checkout -b tagged main && |
Zoltan Klinger | cf3983d | 2014-07-09 12:10:21 +1000 | [diff] [blame] | 2041 | echo bbb >baz && |
| 2042 | git add baz && |
| 2043 | git commit -m baz_commit && |
| 2044 | git tag -s -m signed_tag_msg signed_tag && |
| 2045 | git checkout plain && |
| 2046 | git merge --no-ff -m msg signed_tag && |
| 2047 | git log --graph --show-signature -n1 plain >actual && |
| 2048 | grep "^|\\\ merged tag" actual && |
| 2049 | grep "^| | gpg: Signature made" actual && |
| 2050 | grep "^| | gpg: Good signature" actual |
| 2051 | ' |
| 2052 | |
Harald van Dijk | 237a281 | 2020-02-29 13:07:57 +0000 | [diff] [blame] | 2053 | test_expect_success GPG 'log --graph --show-signature for merged tag in shallow clone' ' |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2054 | test_when_finished "git reset --hard && git checkout main" && |
| 2055 | git checkout -b plain-shallow main && |
Harald van Dijk | 237a281 | 2020-02-29 13:07:57 +0000 | [diff] [blame] | 2056 | echo aaa >bar && |
| 2057 | git add bar && |
| 2058 | git commit -m bar_commit && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2059 | git checkout --detach main && |
Harald van Dijk | 237a281 | 2020-02-29 13:07:57 +0000 | [diff] [blame] | 2060 | echo bbb >baz && |
| 2061 | git add baz && |
| 2062 | git commit -m baz_commit && |
| 2063 | git tag -s -m signed_tag_msg signed_tag_shallow && |
| 2064 | hash=$(git rev-parse HEAD) && |
| 2065 | git checkout plain-shallow && |
| 2066 | git merge --no-ff -m msg signed_tag_shallow && |
| 2067 | git clone --depth 1 --no-local . shallow && |
| 2068 | test_when_finished "rm -rf shallow" && |
| 2069 | git -C shallow log --graph --show-signature -n1 plain-shallow >actual && |
| 2070 | grep "tag signed_tag_shallow names a non-parent $hash" actual |
| 2071 | ' |
| 2072 | |
Hans Jerry Illikainen | f1e3df3 | 2020-03-04 11:48:03 +0000 | [diff] [blame] | 2073 | test_expect_success GPG 'log --graph --show-signature for merged tag with missing key' ' |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2074 | test_when_finished "git reset --hard && git checkout main" && |
| 2075 | git checkout -b plain-nokey main && |
Hans Jerry Illikainen | f1e3df3 | 2020-03-04 11:48:03 +0000 | [diff] [blame] | 2076 | echo aaa >bar && |
| 2077 | git add bar && |
| 2078 | git commit -m bar_commit && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2079 | git checkout -b tagged-nokey main && |
Hans Jerry Illikainen | f1e3df3 | 2020-03-04 11:48:03 +0000 | [diff] [blame] | 2080 | echo bbb >baz && |
| 2081 | git add baz && |
| 2082 | git commit -m baz_commit && |
| 2083 | git tag -s -m signed_tag_msg signed_tag_nokey && |
| 2084 | git checkout plain-nokey && |
| 2085 | git merge --no-ff -m msg signed_tag_nokey && |
| 2086 | GNUPGHOME=. git log --graph --show-signature -n1 plain-nokey >actual && |
| 2087 | grep "^|\\\ merged tag" actual && |
| 2088 | grep "^| | gpg: Signature made" actual && |
Carlo Marcelo Arenas Belón | 46022ca | 2020-05-29 01:20:08 -0700 | [diff] [blame] | 2089 | grep -E "^| | gpg: Can'"'"'t check signature: (public key not found|No public key)" actual |
Hans Jerry Illikainen | f1e3df3 | 2020-03-04 11:48:03 +0000 | [diff] [blame] | 2090 | ' |
| 2091 | |
| 2092 | test_expect_success GPG 'log --graph --show-signature for merged tag with bad signature' ' |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2093 | test_when_finished "git reset --hard && git checkout main" && |
| 2094 | git checkout -b plain-bad main && |
Hans Jerry Illikainen | f1e3df3 | 2020-03-04 11:48:03 +0000 | [diff] [blame] | 2095 | echo aaa >bar && |
| 2096 | git add bar && |
| 2097 | git commit -m bar_commit && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2098 | git checkout -b tagged-bad main && |
Hans Jerry Illikainen | f1e3df3 | 2020-03-04 11:48:03 +0000 | [diff] [blame] | 2099 | echo bbb >baz && |
| 2100 | git add baz && |
| 2101 | git commit -m baz_commit && |
| 2102 | git tag -s -m signed_tag_msg signed_tag_bad && |
| 2103 | git cat-file tag signed_tag_bad >raw && |
| 2104 | sed -e "s/signed_tag_msg/forged/" raw >forged && |
| 2105 | git hash-object -w -t tag forged >forged.tag && |
| 2106 | git checkout plain-bad && |
| 2107 | git merge --no-ff -m msg "$(cat forged.tag)" && |
| 2108 | git log --graph --show-signature -n1 plain-bad >actual && |
| 2109 | grep "^|\\\ merged tag" actual && |
| 2110 | grep "^| | gpg: Signature made" actual && |
| 2111 | grep "^| | gpg: BAD signature from" actual |
| 2112 | ' |
| 2113 | |
| 2114 | test_expect_success GPG 'log --show-signature for merged tag with GPG failure' ' |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2115 | test_when_finished "git reset --hard && git checkout main" && |
| 2116 | git checkout -b plain-fail main && |
Hans Jerry Illikainen | f1e3df3 | 2020-03-04 11:48:03 +0000 | [diff] [blame] | 2117 | echo aaa >bar && |
| 2118 | git add bar && |
| 2119 | git commit -m bar_commit && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2120 | git checkout -b tagged-fail main && |
Hans Jerry Illikainen | f1e3df3 | 2020-03-04 11:48:03 +0000 | [diff] [blame] | 2121 | echo bbb >baz && |
| 2122 | git add baz && |
| 2123 | git commit -m baz_commit && |
| 2124 | git tag -s -m signed_tag_msg signed_tag_fail && |
| 2125 | git checkout plain-fail && |
| 2126 | git merge --no-ff -m msg signed_tag_fail && |
Ævar Arnfjörð Bjarmason | 29d8e21 | 2022-05-12 15:32:16 -0700 | [diff] [blame] | 2127 | if ! test_have_prereq VALGRIND |
| 2128 | then |
| 2129 | TMPDIR="$(pwd)/bogus" git log --show-signature -n1 plain-fail >actual && |
| 2130 | grep "^merged tag" actual && |
| 2131 | grep "^No signature" actual && |
| 2132 | ! grep "^gpg: Signature made" actual |
| 2133 | fi |
Hans Jerry Illikainen | f1e3df3 | 2020-03-04 11:48:03 +0000 | [diff] [blame] | 2134 | ' |
| 2135 | |
Henning Schild | 53fc999 | 2018-07-20 10:28:07 +0200 | [diff] [blame] | 2136 | test_expect_success GPGSM 'log --graph --show-signature for merged tag x509' ' |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2137 | test_when_finished "git reset --hard && git checkout main" && |
Henning Schild | 53fc999 | 2018-07-20 10:28:07 +0200 | [diff] [blame] | 2138 | test_config gpg.format x509 && |
| 2139 | test_config user.signingkey $GIT_COMMITTER_EMAIL && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2140 | git checkout -b plain-x509 main && |
Henning Schild | 53fc999 | 2018-07-20 10:28:07 +0200 | [diff] [blame] | 2141 | echo aaa >bar && |
| 2142 | git add bar && |
| 2143 | git commit -m bar_commit && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2144 | git checkout -b tagged-x509 main && |
Henning Schild | 53fc999 | 2018-07-20 10:28:07 +0200 | [diff] [blame] | 2145 | echo bbb >baz && |
| 2146 | git add baz && |
| 2147 | git commit -m baz_commit && |
| 2148 | git tag -s -m signed_tag_msg signed_tag_x509 && |
| 2149 | git checkout plain-x509 && |
| 2150 | git merge --no-ff -m msg signed_tag_x509 && |
| 2151 | git log --graph --show-signature -n1 plain-x509 >actual && |
| 2152 | grep "^|\\\ merged tag" actual && |
| 2153 | grep "^| | gpgsm: Signature made" actual && |
| 2154 | grep "^| | gpgsm: Good signature" actual |
| 2155 | ' |
| 2156 | |
Hans Jerry Illikainen | f1e3df3 | 2020-03-04 11:48:03 +0000 | [diff] [blame] | 2157 | test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 missing key' ' |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2158 | test_when_finished "git reset --hard && git checkout main" && |
Hans Jerry Illikainen | f1e3df3 | 2020-03-04 11:48:03 +0000 | [diff] [blame] | 2159 | test_config gpg.format x509 && |
| 2160 | test_config user.signingkey $GIT_COMMITTER_EMAIL && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2161 | git checkout -b plain-x509-nokey main && |
Hans Jerry Illikainen | f1e3df3 | 2020-03-04 11:48:03 +0000 | [diff] [blame] | 2162 | echo aaa >bar && |
| 2163 | git add bar && |
| 2164 | git commit -m bar_commit && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2165 | git checkout -b tagged-x509-nokey main && |
Hans Jerry Illikainen | f1e3df3 | 2020-03-04 11:48:03 +0000 | [diff] [blame] | 2166 | echo bbb >baz && |
| 2167 | git add baz && |
| 2168 | git commit -m baz_commit && |
| 2169 | git tag -s -m signed_tag_msg signed_tag_x509_nokey && |
| 2170 | git checkout plain-x509-nokey && |
| 2171 | git merge --no-ff -m msg signed_tag_x509_nokey && |
| 2172 | GNUPGHOME=. git log --graph --show-signature -n1 plain-x509-nokey >actual && |
| 2173 | grep "^|\\\ merged tag" actual && |
Fabian Stelzer | a075e79 | 2022-03-04 11:25:17 +0100 | [diff] [blame] | 2174 | grep -e "^| | gpgsm: certificate not found" \ |
| 2175 | -e "^| | gpgsm: failed to find the certificate: Not found" actual |
Hans Jerry Illikainen | f1e3df3 | 2020-03-04 11:48:03 +0000 | [diff] [blame] | 2176 | ' |
| 2177 | |
| 2178 | test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 bad signature' ' |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2179 | test_when_finished "git reset --hard && git checkout main" && |
Hans Jerry Illikainen | f1e3df3 | 2020-03-04 11:48:03 +0000 | [diff] [blame] | 2180 | test_config gpg.format x509 && |
| 2181 | test_config user.signingkey $GIT_COMMITTER_EMAIL && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2182 | git checkout -b plain-x509-bad main && |
Hans Jerry Illikainen | f1e3df3 | 2020-03-04 11:48:03 +0000 | [diff] [blame] | 2183 | echo aaa >bar && |
| 2184 | git add bar && |
| 2185 | git commit -m bar_commit && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2186 | git checkout -b tagged-x509-bad main && |
Hans Jerry Illikainen | f1e3df3 | 2020-03-04 11:48:03 +0000 | [diff] [blame] | 2187 | echo bbb >baz && |
| 2188 | git add baz && |
| 2189 | git commit -m baz_commit && |
| 2190 | git tag -s -m signed_tag_msg signed_tag_x509_bad && |
| 2191 | git cat-file tag signed_tag_x509_bad >raw && |
| 2192 | sed -e "s/signed_tag_msg/forged/" raw >forged && |
| 2193 | git hash-object -w -t tag forged >forged.tag && |
| 2194 | git checkout plain-x509-bad && |
| 2195 | git merge --no-ff -m msg "$(cat forged.tag)" && |
| 2196 | git log --graph --show-signature -n1 plain-x509-bad >actual && |
| 2197 | grep "^|\\\ merged tag" actual && |
| 2198 | grep "^| | gpgsm: Signature made" actual && |
| 2199 | grep "^| | gpgsm: invalid signature" actual |
| 2200 | ' |
| 2201 | |
| 2202 | |
Mehul Jain | aa37999 | 2016-06-22 22:21:25 +0530 | [diff] [blame] | 2203 | test_expect_success GPG '--no-show-signature overrides --show-signature' ' |
| 2204 | git log -1 --show-signature --no-show-signature signed >actual && |
| 2205 | ! grep "^gpg:" actual |
| 2206 | ' |
| 2207 | |
Mehul Jain | fce04c3 | 2016-06-22 22:21:26 +0530 | [diff] [blame] | 2208 | test_expect_success GPG 'log.showsignature=true behaves like --show-signature' ' |
| 2209 | test_config log.showsignature true && |
| 2210 | git log -1 signed >actual && |
| 2211 | grep "gpg: Signature made" actual && |
| 2212 | grep "gpg: Good signature" actual |
| 2213 | ' |
| 2214 | |
| 2215 | test_expect_success GPG '--no-show-signature overrides log.showsignature=true' ' |
| 2216 | test_config log.showsignature true && |
| 2217 | git log -1 --no-show-signature signed >actual && |
| 2218 | ! grep "^gpg:" actual |
| 2219 | ' |
| 2220 | |
| 2221 | test_expect_success GPG '--show-signature overrides log.showsignature=false' ' |
| 2222 | test_config log.showsignature false && |
| 2223 | git log -1 --show-signature signed >actual && |
| 2224 | grep "gpg: Signature made" actual && |
| 2225 | grep "gpg: Good signature" actual |
| 2226 | ' |
| 2227 | |
Dongcan Jiang | 695985f | 2015-03-11 10:13:02 +0800 | [diff] [blame] | 2228 | test_expect_success 'log --graph --no-walk is forbidden' ' |
| 2229 | test_must_fail git log --graph --no-walk |
| 2230 | ' |
| 2231 | |
Han-Wen Nienhuys | dc47489 | 2021-05-31 16:56:36 +0000 | [diff] [blame] | 2232 | test_expect_success 'log on empty repo fails' ' |
Jeff King | ce11360 | 2015-08-29 01:04:18 -0400 | [diff] [blame] | 2233 | git init empty && |
Han-Wen Nienhuys | 230356b | 2021-05-31 16:56:16 +0000 | [diff] [blame] | 2234 | test_when_finished "rm -rf empty" && |
Jeff King | ce11360 | 2015-08-29 01:04:18 -0400 | [diff] [blame] | 2235 | test_must_fail git -C empty log 2>stderr && |
Han-Wen Nienhuys | dc47489 | 2021-05-31 16:56:36 +0000 | [diff] [blame] | 2236 | test_i18ngrep does.not.have.any.commits stderr |
| 2237 | ' |
| 2238 | |
| 2239 | test_expect_success REFFILES 'log diagnoses bogus HEAD hash' ' |
| 2240 | git init empty && |
| 2241 | test_when_finished "rm -rf empty" && |
Johannes Schindelin | 8f37854 | 2020-11-18 23:44:27 +0000 | [diff] [blame] | 2242 | echo 1234abcd >empty/.git/refs/heads/main && |
Jeff King | ce11360 | 2015-08-29 01:04:18 -0400 | [diff] [blame] | 2243 | test_must_fail git -C empty log 2>stderr && |
Han-Wen Nienhuys | dc47489 | 2021-05-31 16:56:36 +0000 | [diff] [blame] | 2244 | test_i18ngrep broken stderr |
| 2245 | ' |
Han-Wen Nienhuys | 230356b | 2021-05-31 16:56:16 +0000 | [diff] [blame] | 2246 | |
Linus Torvalds | 04ede97 | 2022-08-01 14:15:19 -0400 | [diff] [blame] | 2247 | test_expect_success REFFILES 'log diagnoses bogus HEAD symref' ' |
Han-Wen Nienhuys | 230356b | 2021-05-31 16:56:16 +0000 | [diff] [blame] | 2248 | git init empty && |
Linus Torvalds | 04ede97 | 2022-08-01 14:15:19 -0400 | [diff] [blame] | 2249 | echo "ref: refs/heads/invalid.lock" > empty/.git/HEAD && |
Jeff King | ce11360 | 2015-08-29 01:04:18 -0400 | [diff] [blame] | 2250 | test_must_fail git -C empty log 2>stderr && |
| 2251 | test_i18ngrep broken stderr && |
| 2252 | test_must_fail git -C empty log --default totally-bogus 2>stderr && |
| 2253 | test_i18ngrep broken stderr |
| 2254 | ' |
| 2255 | |
Jeff King | 5d34d1a | 2017-08-02 18:30:19 -0400 | [diff] [blame] | 2256 | test_expect_success 'log does not default to HEAD when rev input is given' ' |
Jeff King | 5d34d1a | 2017-08-02 18:30:19 -0400 | [diff] [blame] | 2257 | git log --branches=does-not-exist >actual && |
Ævar Arnfjörð Bjarmason | d3c6751 | 2018-07-27 17:48:11 +0000 | [diff] [blame] | 2258 | test_must_be_empty actual |
Jeff King | 5d34d1a | 2017-08-02 18:30:19 -0400 | [diff] [blame] | 2259 | ' |
| 2260 | |
Jeff King | 04a0e98 | 2020-08-26 16:13:05 -0400 | [diff] [blame] | 2261 | test_expect_success 'do not default to HEAD with ignored object on cmdline' ' |
| 2262 | git log --ignore-missing $ZERO_OID >actual && |
| 2263 | test_must_be_empty actual |
| 2264 | ' |
| 2265 | |
| 2266 | test_expect_success 'do not default to HEAD with ignored object on stdin' ' |
| 2267 | echo $ZERO_OID | git log --ignore-missing --stdin >actual && |
| 2268 | test_must_be_empty actual |
| 2269 | ' |
| 2270 | |
Jeff King | 728350b | 2015-12-17 01:47:07 -0500 | [diff] [blame] | 2271 | test_expect_success 'set up --source tests' ' |
| 2272 | git checkout --orphan source-a && |
| 2273 | test_commit one && |
| 2274 | test_commit two && |
| 2275 | git checkout -b source-b HEAD^ && |
| 2276 | test_commit three |
| 2277 | ' |
| 2278 | |
| 2279 | test_expect_success 'log --source paints branch names' ' |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 2280 | cat >expect <<-EOF && |
| 2281 | $(git rev-parse --short :/three) source-b three |
| 2282 | $(git rev-parse --short :/two ) source-a two |
| 2283 | $(git rev-parse --short :/one ) source-b one |
Jeff King | 728350b | 2015-12-17 01:47:07 -0500 | [diff] [blame] | 2284 | EOF |
| 2285 | git log --oneline --source source-a source-b >actual && |
| 2286 | test_cmp expect actual |
| 2287 | ' |
| 2288 | |
| 2289 | test_expect_success 'log --source paints tag names' ' |
| 2290 | git tag -m tagged source-tag && |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 2291 | cat >expect <<-EOF && |
| 2292 | $(git rev-parse --short :/three) source-tag three |
| 2293 | $(git rev-parse --short :/two ) source-a two |
| 2294 | $(git rev-parse --short :/one ) source-tag one |
Jeff King | 728350b | 2015-12-17 01:47:07 -0500 | [diff] [blame] | 2295 | EOF |
| 2296 | git log --oneline --source source-tag source-a >actual && |
| 2297 | test_cmp expect actual |
| 2298 | ' |
| 2299 | |
Jeff King | ed79b2c | 2017-05-23 15:51:32 -0400 | [diff] [blame] | 2300 | test_expect_success 'log --source paints symmetric ranges' ' |
brian m. carlson | cb78f4f | 2019-12-21 19:49:21 +0000 | [diff] [blame] | 2301 | cat >expect <<-EOF && |
| 2302 | $(git rev-parse --short :/three) source-b three |
| 2303 | $(git rev-parse --short :/two ) source-a two |
Jeff King | ed79b2c | 2017-05-23 15:51:32 -0400 | [diff] [blame] | 2304 | EOF |
| 2305 | git log --oneline --source source-a...source-b >actual && |
| 2306 | test_cmp expect actual |
| 2307 | ' |
| 2308 | |
Matthew DeVore | 669b1d2 | 2018-10-22 18:13:42 -0700 | [diff] [blame] | 2309 | test_expect_success '--exclude-promisor-objects does not BUG-crash' ' |
| 2310 | test_must_fail git log --exclude-promisor-objects source-a |
| 2311 | ' |
| 2312 | |
Jeff King | d1ed8d6 | 2021-07-14 12:31:36 -0400 | [diff] [blame] | 2313 | test_expect_success 'log --decorate includes all levels of tag annotated tags' ' |
| 2314 | git checkout -b branch && |
| 2315 | git commit --allow-empty -m "new commit" && |
| 2316 | git tag lightweight HEAD && |
| 2317 | git tag -m annotated annotated HEAD && |
| 2318 | git tag -m double-0 double-0 HEAD && |
| 2319 | git tag -m double-1 double-1 double-0 && |
| 2320 | cat >expect <<-\EOF && |
| 2321 | HEAD -> branch, tag: lightweight, tag: double-1, tag: double-0, tag: annotated |
| 2322 | EOF |
| 2323 | git log -1 --format="%D" >actual && |
| 2324 | test_cmp expect actual |
| 2325 | ' |
| 2326 | |
Derrick Stolee | 9215629 | 2022-08-05 17:58:39 +0000 | [diff] [blame] | 2327 | test_expect_success 'log --decorate does not include things outside filter' ' |
| 2328 | reflist="refs/prefetch refs/rebase-merge refs/bundle" && |
| 2329 | |
| 2330 | for ref in $reflist |
| 2331 | do |
| 2332 | git update-ref $ref/fake HEAD || return 1 |
| 2333 | done && |
| 2334 | |
| 2335 | git log --decorate=full --oneline >actual && |
| 2336 | |
| 2337 | # None of the refs are visible: |
| 2338 | ! grep /fake actual |
| 2339 | ' |
| 2340 | |
Jeff King | 51b4594 | 2019-08-06 10:40:16 -0400 | [diff] [blame] | 2341 | test_expect_success 'log --end-of-options' ' |
| 2342 | git update-ref refs/heads/--source HEAD && |
| 2343 | git log --end-of-options --source >actual && |
| 2344 | git log >expect && |
| 2345 | test_cmp expect actual |
| 2346 | ' |
| 2347 | |
René Scharfe | 794c000 | 2021-12-17 17:48:49 +0100 | [diff] [blame] | 2348 | test_expect_success 'set up commits with different authors' ' |
| 2349 | git checkout --orphan authors && |
| 2350 | test_commit --author "Jim <jim@example.com>" jim_1 && |
| 2351 | test_commit --author "Val <val@example.com>" val_1 && |
| 2352 | test_commit --author "Val <val@example.com>" val_2 && |
| 2353 | test_commit --author "Jim <jim@example.com>" jim_2 && |
| 2354 | test_commit --author "Val <val@example.com>" val_3 && |
| 2355 | test_commit --author "Jim <jim@example.com>" jim_3 |
| 2356 | ' |
| 2357 | |
| 2358 | test_expect_success 'log --invert-grep --grep --author' ' |
| 2359 | cat >expect <<-\EOF && |
| 2360 | val_3 |
| 2361 | val_1 |
| 2362 | EOF |
| 2363 | git log --format=%s --author=Val --grep 2 --invert-grep >actual && |
| 2364 | test_cmp expect actual |
| 2365 | ' |
| 2366 | |
Ævar Arnfjörð Bjarmason | 6511312 | 2010-08-15 10:16:25 +0000 | [diff] [blame] | 2367 | test_done |