Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='git log' |
| 4 | |
| 5 | . ./test-lib.sh |
Zoltan Klinger | cf3983d | 2014-07-09 12:10:21 +1000 | [diff] [blame] | 6 | . "$TEST_DIRECTORY/lib-gpg.sh" |
Alex Henrie | 940a911 | 2017-03-23 23:46:31 -0600 | [diff] [blame] | 7 | . "$TEST_DIRECTORY/lib-terminal.sh" |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 8 | |
| 9 | test_expect_success setup ' |
| 10 | |
| 11 | echo one >one && |
| 12 | git add one && |
| 13 | test_tick && |
| 14 | git commit -m initial && |
| 15 | |
| 16 | echo ichi >one && |
| 17 | git add one && |
| 18 | test_tick && |
| 19 | git commit -m second && |
| 20 | |
Arjen Laarhoven | d930508 | 2009-01-22 17:37:24 +0100 | [diff] [blame] | 21 | git mv one ichi && |
| 22 | test_tick && |
| 23 | git commit -m third && |
| 24 | |
| 25 | cp ichi ein && |
| 26 | git add ein && |
| 27 | test_tick && |
| 28 | git commit -m fourth && |
| 29 | |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 30 | mkdir a && |
| 31 | echo ni >a/two && |
| 32 | git add a/two && |
| 33 | test_tick && |
Arjen Laarhoven | d930508 | 2009-01-22 17:37:24 +0100 | [diff] [blame] | 34 | git commit -m fifth && |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 35 | |
Arjen Laarhoven | d930508 | 2009-01-22 17:37:24 +0100 | [diff] [blame] | 36 | git rm a/two && |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 37 | test_tick && |
Arjen Laarhoven | d930508 | 2009-01-22 17:37:24 +0100 | [diff] [blame] | 38 | git commit -m sixth |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 39 | |
| 40 | ' |
| 41 | |
Felipe Contreras | bb93afd | 2009-02-24 23:06:37 +0200 | [diff] [blame] | 42 | printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect |
| 43 | test_expect_success 'pretty' ' |
| 44 | |
| 45 | git log --pretty="format:%s" > actual && |
| 46 | test_cmp expect actual |
| 47 | ' |
| 48 | |
| 49 | printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial\n" > expect |
| 50 | test_expect_success 'pretty (tformat)' ' |
| 51 | |
| 52 | git log --pretty="tformat:%s" > actual && |
| 53 | test_cmp expect actual |
| 54 | ' |
| 55 | |
| 56 | test_expect_success 'pretty (shortcut)' ' |
| 57 | |
| 58 | git log --pretty="%s" > actual && |
| 59 | test_cmp expect actual |
| 60 | ' |
| 61 | |
| 62 | test_expect_success 'format' ' |
| 63 | |
| 64 | git log --format="%s" > actual && |
| 65 | test_cmp expect actual |
| 66 | ' |
| 67 | |
| 68 | cat > expect << EOF |
René Scharfe | 37bb5d7 | 2009-11-22 17:15:29 +0100 | [diff] [blame] | 69 | This is |
| 70 | the sixth |
| 71 | commit. |
| 72 | This is |
| 73 | the fifth |
| 74 | commit. |
| 75 | EOF |
| 76 | |
Jan H. Schönherr | 14e1a4e | 2012-10-18 16:43:28 +0200 | [diff] [blame] | 77 | test_expect_success 'format %w(11,1,2)' ' |
René Scharfe | 37bb5d7 | 2009-11-22 17:15:29 +0100 | [diff] [blame] | 78 | |
Jan H. Schönherr | 14e1a4e | 2012-10-18 16:43:28 +0200 | [diff] [blame] | 79 | 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] | 80 | test_cmp expect actual |
| 81 | ' |
| 82 | |
| 83 | test_expect_success 'format %w(,1,2)' ' |
| 84 | |
| 85 | git log -2 --format="%w(,1,2)This is%nthe %s%ncommit." > actual && |
| 86 | test_cmp expect actual |
| 87 | ' |
| 88 | |
| 89 | cat > expect << EOF |
Felipe Contreras | bb93afd | 2009-02-24 23:06:37 +0200 | [diff] [blame] | 90 | 804a787 sixth |
| 91 | 394ef78 fifth |
| 92 | 5d31159 fourth |
| 93 | 2fbe8c0 third |
| 94 | f7dab8e second |
| 95 | 3a2fdcb initial |
| 96 | EOF |
| 97 | test_expect_success 'oneline' ' |
| 98 | |
| 99 | git log --oneline > actual && |
| 100 | test_cmp expect actual |
| 101 | ' |
| 102 | |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 103 | test_expect_success 'diff-filter=A' ' |
| 104 | |
Matthieu Moy | 5404c11 | 2016-02-25 09:59:21 +0100 | [diff] [blame] | 105 | git log --no-renames --pretty="format:%s" --diff-filter=A HEAD > actual && |
| 106 | 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] | 107 | printf "fifth\nfourth\nthird\ninitial" > expect && |
| 108 | test_cmp expect actual && |
| 109 | test_cmp expect actual-separate |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 110 | |
| 111 | ' |
| 112 | |
| 113 | test_expect_success 'diff-filter=M' ' |
| 114 | |
| 115 | actual=$(git log --pretty="format:%s" --diff-filter=M HEAD) && |
| 116 | expect=$(echo second) && |
Jeff King | a167ece | 2015-03-20 06:09:00 -0400 | [diff] [blame] | 117 | verbose test "$actual" = "$expect" |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 118 | |
| 119 | ' |
| 120 | |
| 121 | test_expect_success 'diff-filter=D' ' |
| 122 | |
Matthieu Moy | 5404c11 | 2016-02-25 09:59:21 +0100 | [diff] [blame] | 123 | actual=$(git log --no-renames --pretty="format:%s" --diff-filter=D HEAD) && |
Arjen Laarhoven | d930508 | 2009-01-22 17:37:24 +0100 | [diff] [blame] | 124 | expect=$(echo sixth ; echo third) && |
Jeff King | a167ece | 2015-03-20 06:09:00 -0400 | [diff] [blame] | 125 | verbose test "$actual" = "$expect" |
Arjen Laarhoven | d930508 | 2009-01-22 17:37:24 +0100 | [diff] [blame] | 126 | |
| 127 | ' |
| 128 | |
| 129 | test_expect_success 'diff-filter=R' ' |
| 130 | |
| 131 | actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) && |
| 132 | expect=$(echo third) && |
Jeff King | a167ece | 2015-03-20 06:09:00 -0400 | [diff] [blame] | 133 | verbose test "$actual" = "$expect" |
Arjen Laarhoven | d930508 | 2009-01-22 17:37:24 +0100 | [diff] [blame] | 134 | |
| 135 | ' |
| 136 | |
| 137 | test_expect_success 'diff-filter=C' ' |
| 138 | |
| 139 | actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) && |
| 140 | expect=$(echo fourth) && |
Jeff King | a167ece | 2015-03-20 06:09:00 -0400 | [diff] [blame] | 141 | verbose test "$actual" = "$expect" |
Arjen Laarhoven | d930508 | 2009-01-22 17:37:24 +0100 | [diff] [blame] | 142 | |
| 143 | ' |
| 144 | |
| 145 | test_expect_success 'git log --follow' ' |
| 146 | |
| 147 | actual=$(git log --follow --pretty="format:%s" ichi) && |
| 148 | expect=$(echo third ; echo second ; echo initial) && |
Jeff King | a167ece | 2015-03-20 06:09:00 -0400 | [diff] [blame] | 149 | verbose test "$actual" = "$expect" |
David Turner | 076c983 | 2015-07-07 21:29:34 -0400 | [diff] [blame] | 150 | ' |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 151 | |
David Turner | 076c983 | 2015-07-07 21:29:34 -0400 | [diff] [blame] | 152 | test_expect_success 'git config log.follow works like --follow' ' |
| 153 | test_config log.follow true && |
| 154 | actual=$(git log --pretty="format:%s" ichi) && |
| 155 | expect=$(echo third ; echo second ; echo initial) && |
| 156 | verbose test "$actual" = "$expect" |
| 157 | ' |
| 158 | |
| 159 | test_expect_success 'git config log.follow does not die with multiple paths' ' |
| 160 | test_config log.follow true && |
| 161 | git log --pretty="format:%s" ichi ein |
| 162 | ' |
| 163 | |
| 164 | test_expect_success 'git config log.follow does not die with no paths' ' |
| 165 | test_config log.follow true && |
| 166 | git log -- |
| 167 | ' |
| 168 | |
| 169 | test_expect_success 'git config log.follow is overridden by --no-follow' ' |
| 170 | test_config log.follow true && |
| 171 | actual=$(git log --no-follow --pretty="format:%s" ichi) && |
| 172 | expect="third" && |
| 173 | verbose test "$actual" = "$expect" |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 174 | ' |
| 175 | |
Michael J Gruber | d5cee0f | 2009-07-17 16:28:06 +0200 | [diff] [blame] | 176 | cat > expect << EOF |
| 177 | 804a787 sixth |
| 178 | 394ef78 fifth |
| 179 | 5d31159 fourth |
| 180 | EOF |
| 181 | test_expect_success 'git log --no-walk <commits> sorts by commit time' ' |
| 182 | git log --no-walk --oneline 5d31159 804a787 394ef78 > actual && |
| 183 | test_cmp expect actual |
| 184 | ' |
| 185 | |
Martin von Zweigbergk | ca92e59 | 2012-08-28 23:15:54 -0700 | [diff] [blame] | 186 | test_expect_success 'git log --no-walk=sorted <commits> sorts by commit time' ' |
| 187 | git log --no-walk=sorted --oneline 5d31159 804a787 394ef78 > actual && |
| 188 | test_cmp expect actual |
| 189 | ' |
| 190 | |
Michael J Gruber | d5cee0f | 2009-07-17 16:28:06 +0200 | [diff] [blame] | 191 | cat > expect << EOF |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 192 | === 804a787 sixth |
| 193 | === 394ef78 fifth |
| 194 | === 5d31159 fourth |
| 195 | EOF |
| 196 | test_expect_success 'git log --line-prefix="=== " --no-walk <commits> sorts by commit time' ' |
| 197 | git log --line-prefix="=== " --no-walk --oneline 5d31159 804a787 394ef78 > actual && |
| 198 | test_cmp expect actual |
| 199 | ' |
| 200 | |
| 201 | cat > expect << EOF |
Michael J Gruber | d5cee0f | 2009-07-17 16:28:06 +0200 | [diff] [blame] | 202 | 5d31159 fourth |
| 203 | 804a787 sixth |
| 204 | 394ef78 fifth |
| 205 | EOF |
Martin von Zweigbergk | ca92e59 | 2012-08-28 23:15:54 -0700 | [diff] [blame] | 206 | test_expect_success 'git log --no-walk=unsorted <commits> leaves list of commits as given' ' |
| 207 | git log --no-walk=unsorted --oneline 5d31159 804a787 394ef78 > actual && |
| 208 | test_cmp expect actual |
| 209 | ' |
| 210 | |
Michael J Gruber | d5cee0f | 2009-07-17 16:28:06 +0200 | [diff] [blame] | 211 | test_expect_success 'git show <commits> leaves list of commits as given' ' |
| 212 | git show --oneline -s 5d31159 804a787 394ef78 > actual && |
| 213 | test_cmp expect actual |
| 214 | ' |
| 215 | |
Jeff King | 0843acf | 2008-08-25 02:15:05 -0400 | [diff] [blame] | 216 | test_expect_success 'setup case sensitivity tests' ' |
| 217 | echo case >one && |
| 218 | test_tick && |
Jonathan Nieder | a48fcd8 | 2010-10-30 20:46:54 -0500 | [diff] [blame] | 219 | git add one && |
Jeff King | 0843acf | 2008-08-25 02:15:05 -0400 | [diff] [blame] | 220 | git commit -a -m Second |
| 221 | ' |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 222 | |
Jeff King | 0843acf | 2008-08-25 02:15:05 -0400 | [diff] [blame] | 223 | test_expect_success 'log --grep' ' |
| 224 | echo second >expect && |
| 225 | git log -1 --pretty="tformat:%s" --grep=sec >actual && |
| 226 | test_cmp expect actual |
| 227 | ' |
| 228 | |
Christoph Junghans | 22dfa8a | 2015-01-12 18:33:32 -0700 | [diff] [blame] | 229 | cat > expect << EOF |
| 230 | second |
| 231 | initial |
| 232 | EOF |
| 233 | test_expect_success 'log --invert-grep --grep' ' |
Ævar Arnfjörð Bjarmason | 9e3cbc5 | 2017-05-20 21:42:08 +0000 | [diff] [blame] | 234 | # Fixed |
| 235 | git -c grep.patternType=fixed log --pretty="tformat:%s" --invert-grep --grep=th --grep=Sec >actual && |
| 236 | test_cmp expect actual && |
| 237 | |
| 238 | # POSIX basic |
| 239 | git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual && |
| 240 | test_cmp expect actual && |
| 241 | |
| 242 | # POSIX extended |
| 243 | git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual && |
| 244 | test_cmp expect actual && |
| 245 | |
| 246 | # PCRE |
| 247 | if test_have_prereq PCRE |
| 248 | then |
| 249 | git -c grep.patternType=perl log --pretty="tformat:%s" --invert-grep --grep=t[h] --grep=S[e]c >actual && |
| 250 | test_cmp expect actual |
| 251 | fi |
Christoph Junghans | 22dfa8a | 2015-01-12 18:33:32 -0700 | [diff] [blame] | 252 | ' |
| 253 | |
| 254 | test_expect_success 'log --invert-grep --grep -i' ' |
| 255 | echo initial >expect && |
Ævar Arnfjörð Bjarmason | 9e3cbc5 | 2017-05-20 21:42:08 +0000 | [diff] [blame] | 256 | |
| 257 | # Fixed |
| 258 | git -c grep.patternType=fixed log --pretty="tformat:%s" --invert-grep -i --grep=th --grep=Sec >actual && |
| 259 | test_cmp expect actual && |
| 260 | |
| 261 | # POSIX basic |
| 262 | git -c grep.patternType=basic log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual && |
| 263 | test_cmp expect actual && |
| 264 | |
| 265 | # POSIX extended |
| 266 | git -c grep.patternType=extended log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual && |
| 267 | test_cmp expect actual && |
| 268 | |
| 269 | # PCRE |
| 270 | if test_have_prereq PCRE |
| 271 | then |
| 272 | git -c grep.patternType=perl log --pretty="tformat:%s" --invert-grep -i --grep=t[h] --grep=S[e]c >actual && |
| 273 | test_cmp expect actual |
| 274 | fi |
Christoph Junghans | 22dfa8a | 2015-01-12 18:33:32 -0700 | [diff] [blame] | 275 | ' |
| 276 | |
Matthieu Moy | 7d7b86f | 2010-08-05 10:22:55 +0200 | [diff] [blame] | 277 | test_expect_success 'log --grep option parsing' ' |
| 278 | echo second >expect && |
| 279 | git log -1 --pretty="tformat:%s" --grep sec >actual && |
| 280 | test_cmp expect actual && |
| 281 | test_must_fail git log -1 --pretty="tformat:%s" --grep |
| 282 | ' |
| 283 | |
Jeff King | 0843acf | 2008-08-25 02:15:05 -0400 | [diff] [blame] | 284 | test_expect_success 'log -i --grep' ' |
| 285 | echo Second >expect && |
| 286 | git log -1 --pretty="tformat:%s" -i --grep=sec >actual && |
| 287 | test_cmp expect actual |
| 288 | ' |
| 289 | |
| 290 | test_expect_success 'log --grep -i' ' |
| 291 | echo Second >expect && |
Ævar Arnfjörð Bjarmason | 9e3cbc5 | 2017-05-20 21:42:08 +0000 | [diff] [blame] | 292 | |
| 293 | # Fixed |
Jeff King | 0843acf | 2008-08-25 02:15:05 -0400 | [diff] [blame] | 294 | git log -1 --pretty="tformat:%s" --grep=sec -i >actual && |
Ævar Arnfjörð Bjarmason | 9e3cbc5 | 2017-05-20 21:42:08 +0000 | [diff] [blame] | 295 | test_cmp expect actual && |
| 296 | |
| 297 | # POSIX basic |
| 298 | git -c grep.patternType=basic log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual && |
| 299 | test_cmp expect actual && |
| 300 | |
| 301 | # POSIX extended |
| 302 | git -c grep.patternType=extended log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual && |
| 303 | test_cmp expect actual && |
| 304 | |
| 305 | # PCRE |
| 306 | if test_have_prereq PCRE |
| 307 | then |
| 308 | git -c grep.patternType=perl log -1 --pretty="tformat:%s" --grep=s[e]c -i >actual && |
| 309 | test_cmp expect actual |
| 310 | fi |
Jeff King | 0843acf | 2008-08-25 02:15:05 -0400 | [diff] [blame] | 311 | ' |
Arjen Laarhoven | 0faf2da | 2007-12-25 12:06:47 +0100 | [diff] [blame] | 312 | |
Junio C Hamano | 34a4ae5 | 2012-10-03 14:50:51 -0700 | [diff] [blame] | 313 | test_expect_success 'log -F -E --grep=<ere> uses ere' ' |
| 314 | echo second >expect && |
Ævar Arnfjörð Bjarmason | 9df4676 | 2017-05-20 21:42:07 +0000 | [diff] [blame] | 315 | # basic would need \(s\) to do the same |
| 316 | git log -1 --pretty="tformat:%s" -F -E --grep="(s).c.nd" >actual && |
| 317 | test_cmp expect actual |
| 318 | ' |
| 319 | |
| 320 | test_expect_success PCRE 'log -F -E --perl-regexp --grep=<pcre> uses PCRE' ' |
| 321 | test_when_finished "rm -rf num_commits" && |
| 322 | git init num_commits && |
| 323 | ( |
| 324 | cd num_commits && |
| 325 | test_commit 1d && |
| 326 | test_commit 2e |
| 327 | ) && |
| 328 | |
| 329 | # In PCRE \d in [\d] is like saying "0-9", and matches the 2 |
| 330 | # in 2e... |
| 331 | echo 2e >expect && |
| 332 | git -C num_commits log -1 --pretty="tformat:%s" -F -E --perl-regexp --grep="[\d]" >actual && |
| 333 | test_cmp expect actual && |
| 334 | |
| 335 | # ...in POSIX basic and extended it is the same as [d], |
| 336 | # i.e. "d", which matches 1d, but does not match 2e. |
| 337 | echo 1d >expect && |
| 338 | 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] | 339 | test_cmp expect actual |
| 340 | ' |
| 341 | |
Junio C Hamano | 8465541 | 2016-07-22 11:43:14 -0700 | [diff] [blame] | 342 | test_expect_success 'log with grep.patternType configuration' ' |
| 343 | >expect && |
| 344 | git -c grep.patterntype=fixed \ |
| 345 | log -1 --pretty=tformat:%s --grep=s.c.nd >actual && |
| 346 | test_cmp expect actual |
| 347 | ' |
| 348 | |
| 349 | test_expect_success 'log with grep.patternType configuration and command line' ' |
| 350 | echo second >expect && |
| 351 | git -c grep.patterntype=fixed \ |
| 352 | log -1 --pretty=tformat:%s --basic-regexp --grep=s.c.nd >actual && |
| 353 | test_cmp expect actual |
| 354 | ' |
| 355 | |
Ævar Arnfjörð Bjarmason | 9df4676 | 2017-05-20 21:42:07 +0000 | [diff] [blame] | 356 | test_expect_success 'log with various grep.patternType configurations & command-lines' ' |
| 357 | git init pattern-type && |
| 358 | ( |
| 359 | cd pattern-type && |
| 360 | test_commit 1 file A && |
| 361 | |
| 362 | # The tagname is overridden here because creating a |
| 363 | # tag called "(1|2)" as test_commit would otherwise |
| 364 | # implicitly do would fail on e.g. MINGW. |
| 365 | test_commit "(1|2)" file B 2 && |
| 366 | |
| 367 | echo "(1|2)" >expect.fixed && |
| 368 | cp expect.fixed expect.basic && |
| 369 | cp expect.fixed expect.extended && |
| 370 | cp expect.fixed expect.perl && |
| 371 | |
| 372 | # A strcmp-like match with fixed. |
| 373 | git -c grep.patternType=fixed log --pretty=tformat:%s \ |
| 374 | --grep="(1|2)" >actual.fixed && |
| 375 | |
| 376 | # POSIX basic matches (, | and ) literally. |
| 377 | git -c grep.patternType=basic log --pretty=tformat:%s \ |
| 378 | --grep="(.|.)" >actual.basic && |
| 379 | |
| 380 | # POSIX extended needs to have | escaped to match it |
| 381 | # literally, whereas under basic this is the same as |
| 382 | # (|2), i.e. it would also match "1". This test checks |
| 383 | # for extended by asserting that it is not matching |
| 384 | # what basic would match. |
| 385 | git -c grep.patternType=extended log --pretty=tformat:%s \ |
| 386 | --grep="\|2" >actual.extended && |
| 387 | if test_have_prereq PCRE |
| 388 | then |
| 389 | # Only PCRE would match [\d]\| with only |
| 390 | # "(1|2)" due to [\d]. POSIX basic would match |
| 391 | # both it and "1" since similarly to the |
| 392 | # extended match above it is the same as |
| 393 | # \([\d]\|\). POSIX extended would |
| 394 | # match neither. |
| 395 | git -c grep.patternType=perl log --pretty=tformat:%s \ |
| 396 | --grep="[\d]\|" >actual.perl && |
| 397 | test_cmp expect.perl actual.perl |
| 398 | fi && |
| 399 | test_cmp expect.fixed actual.fixed && |
| 400 | test_cmp expect.basic actual.basic && |
| 401 | test_cmp expect.extended actual.extended && |
| 402 | |
| 403 | git log --pretty=tformat:%s -F \ |
| 404 | --grep="(1|2)" >actual.fixed.short-arg && |
| 405 | git log --pretty=tformat:%s -E \ |
| 406 | --grep="\|2" >actual.extended.short-arg && |
Ævar Arnfjörð Bjarmason | 7531a2d | 2017-05-25 20:05:24 +0000 | [diff] [blame] | 407 | if test_have_prereq PCRE |
| 408 | then |
| 409 | git log --pretty=tformat:%s -P \ |
| 410 | --grep="[\d]\|" >actual.perl.short-arg |
| 411 | else |
| 412 | test_must_fail git log -P \ |
| 413 | --grep="[\d]\|" |
| 414 | fi && |
Ævar Arnfjörð Bjarmason | 9df4676 | 2017-05-20 21:42:07 +0000 | [diff] [blame] | 415 | test_cmp expect.fixed actual.fixed.short-arg && |
| 416 | test_cmp expect.extended actual.extended.short-arg && |
Ævar Arnfjörð Bjarmason | 7531a2d | 2017-05-25 20:05:24 +0000 | [diff] [blame] | 417 | if test_have_prereq PCRE |
| 418 | then |
| 419 | test_cmp expect.perl actual.perl.short-arg |
| 420 | fi && |
Ævar Arnfjörð Bjarmason | 9df4676 | 2017-05-20 21:42:07 +0000 | [diff] [blame] | 421 | |
| 422 | git log --pretty=tformat:%s --fixed-strings \ |
| 423 | --grep="(1|2)" >actual.fixed.long-arg && |
| 424 | git log --pretty=tformat:%s --basic-regexp \ |
| 425 | --grep="(.|.)" >actual.basic.long-arg && |
| 426 | git log --pretty=tformat:%s --extended-regexp \ |
| 427 | --grep="\|2" >actual.extended.long-arg && |
| 428 | if test_have_prereq PCRE |
| 429 | then |
| 430 | git log --pretty=tformat:%s --perl-regexp \ |
| 431 | --grep="[\d]\|" >actual.perl.long-arg && |
| 432 | test_cmp expect.perl actual.perl.long-arg |
Ævar Arnfjörð Bjarmason | 9001c19 | 2017-05-20 21:42:09 +0000 | [diff] [blame] | 433 | else |
| 434 | test_must_fail git log --perl-regexp \ |
| 435 | --grep="[\d]\|" |
Ævar Arnfjörð Bjarmason | 9df4676 | 2017-05-20 21:42:07 +0000 | [diff] [blame] | 436 | fi && |
| 437 | test_cmp expect.fixed actual.fixed.long-arg && |
| 438 | test_cmp expect.basic actual.basic.long-arg && |
| 439 | test_cmp expect.extended actual.extended.long-arg |
| 440 | ) |
| 441 | ' |
| 442 | |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 443 | cat > expect <<EOF |
| 444 | * Second |
| 445 | * sixth |
| 446 | * fifth |
| 447 | * fourth |
| 448 | * third |
| 449 | * second |
| 450 | * initial |
| 451 | EOF |
| 452 | |
| 453 | test_expect_success 'simple log --graph' ' |
| 454 | git log --graph --pretty=tformat:%s >actual && |
| 455 | test_cmp expect actual |
| 456 | ' |
| 457 | |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 458 | cat > expect <<EOF |
| 459 | 123 * Second |
| 460 | 123 * sixth |
| 461 | 123 * fifth |
| 462 | 123 * fourth |
| 463 | 123 * third |
| 464 | 123 * second |
| 465 | 123 * initial |
| 466 | EOF |
| 467 | |
| 468 | test_expect_success 'simple log --graph --line-prefix="123 "' ' |
| 469 | git log --graph --line-prefix="123 " --pretty=tformat:%s >actual && |
| 470 | test_cmp expect actual |
| 471 | ' |
| 472 | |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 473 | test_expect_success 'set up merge history' ' |
| 474 | git checkout -b side HEAD~4 && |
| 475 | test_commit side-1 1 1 && |
| 476 | test_commit side-2 2 2 && |
| 477 | git checkout master && |
| 478 | git merge side |
| 479 | ' |
| 480 | |
| 481 | cat > expect <<\EOF |
| 482 | * Merge branch 'side' |
| 483 | |\ |
| 484 | | * side-2 |
| 485 | | * side-1 |
| 486 | * | Second |
| 487 | * | sixth |
| 488 | * | fifth |
| 489 | * | fourth |
| 490 | |/ |
| 491 | * third |
| 492 | * second |
| 493 | * initial |
| 494 | EOF |
| 495 | |
| 496 | test_expect_success 'log --graph with merge' ' |
| 497 | git log --graph --date-order --pretty=tformat:%s | |
Stephen Boyd | 9524cf2 | 2010-01-26 15:08:31 -0800 | [diff] [blame] | 498 | sed "s/ *\$//" >actual && |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 499 | test_cmp expect actual |
| 500 | ' |
| 501 | |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 502 | cat > expect <<\EOF |
| 503 | | | | * Merge branch 'side' |
| 504 | | | | |\ |
| 505 | | | | | * side-2 |
| 506 | | | | | * side-1 |
| 507 | | | | * | Second |
| 508 | | | | * | sixth |
| 509 | | | | * | fifth |
| 510 | | | | * | fourth |
| 511 | | | | |/ |
| 512 | | | | * third |
| 513 | | | | * second |
| 514 | | | | * initial |
| 515 | EOF |
| 516 | |
| 517 | test_expect_success 'log --graph --line-prefix="| | | " with merge' ' |
| 518 | git log --line-prefix="| | | " --graph --date-order --pretty=tformat:%s | |
| 519 | sed "s/ *\$//" >actual && |
| 520 | test_cmp expect actual |
| 521 | ' |
| 522 | |
Nguyễn Thái Ngọc Duy | 73c727d | 2017-01-19 18:41:23 +0700 | [diff] [blame] | 523 | cat > expect.colors <<\EOF |
| 524 | * Merge branch 'side' |
| 525 | <BLUE>|<RESET><CYAN>\<RESET> |
| 526 | <BLUE>|<RESET> * side-2 |
| 527 | <BLUE>|<RESET> * side-1 |
| 528 | * <CYAN>|<RESET> Second |
| 529 | * <CYAN>|<RESET> sixth |
| 530 | * <CYAN>|<RESET> fifth |
| 531 | * <CYAN>|<RESET> fourth |
| 532 | <CYAN>|<RESET><CYAN>/<RESET> |
| 533 | * third |
| 534 | * second |
| 535 | * initial |
| 536 | EOF |
| 537 | |
| 538 | test_expect_success 'log --graph with merge with log.graphColors' ' |
Jeff King | 55cccf4 | 2017-02-01 01:21:29 +0100 | [diff] [blame] | 539 | test_config log.graphColors " blue,invalid-color, cyan, red , " && |
Nguyễn Thái Ngọc Duy | 73c727d | 2017-01-19 18:41:23 +0700 | [diff] [blame] | 540 | git log --color=always --graph --date-order --pretty=tformat:%s | |
| 541 | test_decode_color | sed "s/ *\$//" >actual && |
| 542 | test_cmp expect.colors actual |
| 543 | ' |
| 544 | |
Michał Kiedrowicz | 656197a | 2009-07-25 01:45:00 +0200 | [diff] [blame] | 545 | test_expect_success 'log --raw --graph -m with merge' ' |
| 546 | git log --raw --graph --oneline -m master | head -n 500 >actual && |
| 547 | grep "initial" actual |
| 548 | ' |
| 549 | |
| 550 | test_expect_success 'diff-tree --graph' ' |
| 551 | git diff-tree --graph master^ | head -n 500 >actual && |
| 552 | grep "one" actual |
| 553 | ' |
| 554 | |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 555 | cat > expect <<\EOF |
| 556 | * commit master |
| 557 | |\ Merge: A B |
| 558 | | | Author: A U Thor <author@example.com> |
| 559 | | | |
| 560 | | | Merge branch 'side' |
| 561 | | | |
Junio C Hamano | ef1e740 | 2017-03-29 16:39:16 +0200 | [diff] [blame] | 562 | | * commit tags/side-2 |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 563 | | | Author: A U Thor <author@example.com> |
| 564 | | | |
| 565 | | | side-2 |
| 566 | | | |
| 567 | | * commit tags/side-1 |
| 568 | | | Author: A U Thor <author@example.com> |
| 569 | | | |
| 570 | | | side-1 |
| 571 | | | |
| 572 | * | commit master~1 |
| 573 | | | Author: A U Thor <author@example.com> |
| 574 | | | |
| 575 | | | Second |
| 576 | | | |
| 577 | * | commit master~2 |
| 578 | | | Author: A U Thor <author@example.com> |
| 579 | | | |
| 580 | | | sixth |
| 581 | | | |
| 582 | * | commit master~3 |
| 583 | | | Author: A U Thor <author@example.com> |
| 584 | | | |
| 585 | | | fifth |
| 586 | | | |
| 587 | * | commit master~4 |
| 588 | |/ Author: A U Thor <author@example.com> |
| 589 | | |
| 590 | | fourth |
| 591 | | |
| 592 | * commit tags/side-1~1 |
| 593 | | Author: A U Thor <author@example.com> |
| 594 | | |
| 595 | | third |
| 596 | | |
| 597 | * commit tags/side-1~2 |
| 598 | | Author: A U Thor <author@example.com> |
| 599 | | |
| 600 | | second |
| 601 | | |
| 602 | * commit tags/side-1~3 |
| 603 | Author: A U Thor <author@example.com> |
| 604 | |
| 605 | initial |
| 606 | EOF |
| 607 | |
| 608 | test_expect_success 'log --graph with full output' ' |
| 609 | git log --graph --date-order --pretty=short | |
| 610 | git name-rev --name-only --stdin | |
Stephen Boyd | 9524cf2 | 2010-01-26 15:08:31 -0800 | [diff] [blame] | 611 | sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual && |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 612 | test_cmp expect actual |
| 613 | ' |
| 614 | |
| 615 | test_expect_success 'set up more tangled history' ' |
| 616 | git checkout -b tangle HEAD~6 && |
| 617 | test_commit tangle-a tangle-a a && |
| 618 | git merge master~3 && |
| 619 | git merge side~1 && |
| 620 | git checkout master && |
Allan Caffee | 7b1d626 | 2009-04-22 17:27:15 -0400 | [diff] [blame] | 621 | git merge tangle && |
| 622 | git checkout -b reach && |
| 623 | test_commit reach && |
| 624 | git checkout master && |
| 625 | git checkout -b octopus-a && |
| 626 | test_commit octopus-a && |
| 627 | git checkout master && |
| 628 | git checkout -b octopus-b && |
| 629 | test_commit octopus-b && |
| 630 | git checkout master && |
| 631 | test_commit seventh && |
Jonathan Nieder | a48fcd8 | 2010-10-30 20:46:54 -0500 | [diff] [blame] | 632 | git merge octopus-a octopus-b && |
Allan Caffee | 7b1d626 | 2009-04-22 17:27:15 -0400 | [diff] [blame] | 633 | git merge reach |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 634 | ' |
| 635 | |
| 636 | cat > expect <<\EOF |
Junio C Hamano | 57b58db | 2011-11-04 21:31:28 -0700 | [diff] [blame] | 637 | * Merge tag 'reach' |
Allan Caffee | 7b1d626 | 2009-04-22 17:27:15 -0400 | [diff] [blame] | 638 | |\ |
| 639 | | \ |
| 640 | | \ |
Junio C Hamano | 57b58db | 2011-11-04 21:31:28 -0700 | [diff] [blame] | 641 | *-. \ Merge tags 'octopus-a' and 'octopus-b' |
Allan Caffee | 7b1d626 | 2009-04-22 17:27:15 -0400 | [diff] [blame] | 642 | |\ \ \ |
| 643 | * | | | seventh |
| 644 | | | * | octopus-b |
| 645 | | |/ / |
| 646 | |/| | |
| 647 | | * | octopus-a |
| 648 | |/ / |
| 649 | | * reach |
| 650 | |/ |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 651 | * Merge branch 'tangle' |
| 652 | |\ |
| 653 | | * Merge branch 'side' (early part) into tangle |
| 654 | | |\ |
| 655 | | * \ Merge branch 'master' (early part) into tangle |
| 656 | | |\ \ |
| 657 | | * | | tangle-a |
| 658 | * | | | Merge branch 'side' |
| 659 | |\ \ \ \ |
| 660 | | * | | | side-2 |
Allan Caffee | eaf158f | 2009-04-21 08:47:01 -0400 | [diff] [blame] | 661 | | | |_|/ |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 662 | | |/| | |
| 663 | | * | | side-1 |
| 664 | * | | | Second |
| 665 | * | | | sixth |
Allan Caffee | eaf158f | 2009-04-21 08:47:01 -0400 | [diff] [blame] | 666 | | |_|/ |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 667 | |/| | |
| 668 | * | | fifth |
| 669 | * | | fourth |
| 670 | |/ / |
| 671 | * | third |
| 672 | |/ |
| 673 | * second |
| 674 | * initial |
| 675 | EOF |
| 676 | |
Linus Torvalds | 95110d7 | 2009-04-26 12:29:13 -0700 | [diff] [blame] | 677 | test_expect_success 'log --graph with merge' ' |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 678 | git log --graph --date-order --pretty=tformat:%s | |
Stephen Boyd | 9524cf2 | 2010-01-26 15:08:31 -0800 | [diff] [blame] | 679 | sed "s/ *\$//" >actual && |
Thomas Rast | 289e162 | 2009-02-19 12:13:38 +0100 | [diff] [blame] | 680 | test_cmp expect actual |
| 681 | ' |
| 682 | |
Junio C Hamano | 8a3d203 | 2010-02-17 10:20:49 -0800 | [diff] [blame] | 683 | test_expect_success 'log.decorate configuration' ' |
Alex Henrie | 940a911 | 2017-03-23 23:46:31 -0600 | [diff] [blame] | 684 | git log --oneline --no-decorate >expect.none && |
Junio C Hamano | 4f62c2b | 2010-04-08 10:17:17 -0700 | [diff] [blame] | 685 | git log --oneline --decorate >expect.short && |
| 686 | git log --oneline --decorate=full >expect.full && |
Junio C Hamano | 8a3d203 | 2010-02-17 10:20:49 -0800 | [diff] [blame] | 687 | |
| 688 | echo "[log] decorate" >>.git/config && |
Junio C Hamano | 635530a | 2010-04-06 14:48:55 -0700 | [diff] [blame] | 689 | git log --oneline >actual && |
Junio C Hamano | 4f62c2b | 2010-04-08 10:17:17 -0700 | [diff] [blame] | 690 | test_cmp expect.short actual && |
Junio C Hamano | 8a3d203 | 2010-02-17 10:20:49 -0800 | [diff] [blame] | 691 | |
Yann Droneaud | 90e76b7 | 2013-03-24 22:06:06 +0100 | [diff] [blame] | 692 | test_config log.decorate true && |
Junio C Hamano | 635530a | 2010-04-06 14:48:55 -0700 | [diff] [blame] | 693 | git log --oneline >actual && |
Junio C Hamano | 4f62c2b | 2010-04-08 10:17:17 -0700 | [diff] [blame] | 694 | test_cmp expect.short actual && |
| 695 | git log --oneline --decorate=full >actual && |
| 696 | test_cmp expect.full actual && |
| 697 | git log --oneline --decorate=no >actual && |
| 698 | test_cmp expect.none actual && |
Junio C Hamano | 8a3d203 | 2010-02-17 10:20:49 -0800 | [diff] [blame] | 699 | |
Yann Droneaud | 90e76b7 | 2013-03-24 22:06:06 +0100 | [diff] [blame] | 700 | test_config log.decorate no && |
Junio C Hamano | 635530a | 2010-04-06 14:48:55 -0700 | [diff] [blame] | 701 | git log --oneline >actual && |
Junio C Hamano | 4f62c2b | 2010-04-08 10:17:17 -0700 | [diff] [blame] | 702 | test_cmp expect.none actual && |
| 703 | git log --oneline --decorate >actual && |
| 704 | test_cmp expect.short actual && |
| 705 | git log --oneline --decorate=full >actual && |
| 706 | test_cmp expect.full actual && |
Junio C Hamano | 8a3d203 | 2010-02-17 10:20:49 -0800 | [diff] [blame] | 707 | |
Yann Droneaud | 90e76b7 | 2013-03-24 22:06:06 +0100 | [diff] [blame] | 708 | test_config log.decorate 1 && |
Jeff King | b2be2f6 | 2010-11-17 12:00:45 -0500 | [diff] [blame] | 709 | git log --oneline >actual && |
| 710 | test_cmp expect.short actual && |
| 711 | git log --oneline --decorate=full >actual && |
| 712 | test_cmp expect.full actual && |
| 713 | git log --oneline --decorate=no >actual && |
| 714 | test_cmp expect.none actual && |
| 715 | |
Yann Droneaud | 90e76b7 | 2013-03-24 22:06:06 +0100 | [diff] [blame] | 716 | test_config log.decorate short && |
Junio C Hamano | 635530a | 2010-04-06 14:48:55 -0700 | [diff] [blame] | 717 | git log --oneline >actual && |
Junio C Hamano | 4f62c2b | 2010-04-08 10:17:17 -0700 | [diff] [blame] | 718 | test_cmp expect.short actual && |
| 719 | git log --oneline --no-decorate >actual && |
| 720 | test_cmp expect.none actual && |
| 721 | git log --oneline --decorate=full >actual && |
| 722 | test_cmp expect.full actual && |
Junio C Hamano | 8a3d203 | 2010-02-17 10:20:49 -0800 | [diff] [blame] | 723 | |
Yann Droneaud | 90e76b7 | 2013-03-24 22:06:06 +0100 | [diff] [blame] | 724 | test_config log.decorate full && |
Junio C Hamano | 635530a | 2010-04-06 14:48:55 -0700 | [diff] [blame] | 725 | git log --oneline >actual && |
Junio C Hamano | 4f62c2b | 2010-04-08 10:17:17 -0700 | [diff] [blame] | 726 | test_cmp expect.full actual && |
| 727 | git log --oneline --no-decorate >actual && |
| 728 | test_cmp expect.none actual && |
| 729 | git log --oneline --decorate >actual && |
Jeff King | 8fb2687 | 2015-03-20 06:06:15 -0400 | [diff] [blame] | 730 | test_cmp expect.short actual && |
Junio C Hamano | 8a3d203 | 2010-02-17 10:20:49 -0800 | [diff] [blame] | 731 | |
Yann Droneaud | 90e76b7 | 2013-03-24 22:06:06 +0100 | [diff] [blame] | 732 | test_unconfig log.decorate && |
Jay Soffian | 0c47695 | 2011-05-18 13:56:04 -0400 | [diff] [blame] | 733 | git log --pretty=raw >expect.raw && |
Yann Droneaud | 90e76b7 | 2013-03-24 22:06:06 +0100 | [diff] [blame] | 734 | test_config log.decorate full && |
Jay Soffian | 0c47695 | 2011-05-18 13:56:04 -0400 | [diff] [blame] | 735 | git log --pretty=raw >actual && |
| 736 | test_cmp expect.raw actual |
| 737 | |
| 738 | ' |
| 739 | |
Rafael Ascensão | 65516f5 | 2017-11-21 21:33:41 +0000 | [diff] [blame] | 740 | test_expect_success 'decorate-refs with glob' ' |
| 741 | cat >expect.decorate <<-\EOF && |
| 742 | Merge-tag-reach |
| 743 | Merge-tags-octopus-a-and-octopus-b |
| 744 | seventh |
| 745 | octopus-b (octopus-b) |
| 746 | octopus-a (octopus-a) |
| 747 | reach |
| 748 | EOF |
| 749 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ |
| 750 | --decorate-refs="heads/octopus*" >actual && |
| 751 | test_cmp expect.decorate actual |
| 752 | ' |
| 753 | |
| 754 | test_expect_success 'decorate-refs without globs' ' |
| 755 | cat >expect.decorate <<-\EOF && |
| 756 | Merge-tag-reach |
| 757 | Merge-tags-octopus-a-and-octopus-b |
| 758 | seventh |
| 759 | octopus-b |
| 760 | octopus-a |
| 761 | reach (tag: reach) |
| 762 | EOF |
| 763 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ |
| 764 | --decorate-refs="tags/reach" >actual && |
| 765 | test_cmp expect.decorate actual |
| 766 | ' |
| 767 | |
| 768 | test_expect_success 'multiple decorate-refs' ' |
| 769 | cat >expect.decorate <<-\EOF && |
| 770 | Merge-tag-reach |
| 771 | Merge-tags-octopus-a-and-octopus-b |
| 772 | seventh |
| 773 | octopus-b (octopus-b) |
| 774 | octopus-a (octopus-a) |
| 775 | reach (tag: reach) |
| 776 | EOF |
| 777 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ |
| 778 | --decorate-refs="heads/octopus*" \ |
| 779 | --decorate-refs="tags/reach" >actual && |
| 780 | test_cmp expect.decorate actual |
| 781 | ' |
| 782 | |
| 783 | test_expect_success 'decorate-refs-exclude with glob' ' |
| 784 | cat >expect.decorate <<-\EOF && |
| 785 | Merge-tag-reach (HEAD -> master) |
| 786 | Merge-tags-octopus-a-and-octopus-b |
| 787 | seventh (tag: seventh) |
| 788 | octopus-b (tag: octopus-b) |
| 789 | octopus-a (tag: octopus-a) |
| 790 | reach (tag: reach, reach) |
| 791 | EOF |
| 792 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ |
| 793 | --decorate-refs-exclude="heads/octopus*" >actual && |
| 794 | test_cmp expect.decorate actual |
| 795 | ' |
| 796 | |
| 797 | test_expect_success 'decorate-refs-exclude without globs' ' |
| 798 | cat >expect.decorate <<-\EOF && |
| 799 | Merge-tag-reach (HEAD -> master) |
| 800 | Merge-tags-octopus-a-and-octopus-b |
| 801 | seventh (tag: seventh) |
| 802 | octopus-b (tag: octopus-b, octopus-b) |
| 803 | octopus-a (tag: octopus-a, octopus-a) |
| 804 | reach (reach) |
| 805 | EOF |
| 806 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ |
| 807 | --decorate-refs-exclude="tags/reach" >actual && |
| 808 | test_cmp expect.decorate actual |
| 809 | ' |
| 810 | |
| 811 | test_expect_success 'multiple decorate-refs-exclude' ' |
| 812 | cat >expect.decorate <<-\EOF && |
| 813 | Merge-tag-reach (HEAD -> master) |
| 814 | Merge-tags-octopus-a-and-octopus-b |
| 815 | seventh (tag: seventh) |
| 816 | octopus-b (tag: octopus-b) |
| 817 | octopus-a (tag: octopus-a) |
| 818 | reach (reach) |
| 819 | EOF |
| 820 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ |
| 821 | --decorate-refs-exclude="heads/octopus*" \ |
| 822 | --decorate-refs-exclude="tags/reach" >actual && |
| 823 | test_cmp expect.decorate actual |
| 824 | ' |
| 825 | |
| 826 | test_expect_success 'decorate-refs and decorate-refs-exclude' ' |
| 827 | cat >expect.decorate <<-\EOF && |
| 828 | Merge-tag-reach (master) |
| 829 | Merge-tags-octopus-a-and-octopus-b |
| 830 | seventh |
| 831 | octopus-b |
| 832 | octopus-a |
| 833 | reach (reach) |
| 834 | EOF |
| 835 | git log -n6 --decorate=short --pretty="tformat:%f%d" \ |
| 836 | --decorate-refs="heads/*" \ |
| 837 | --decorate-refs-exclude="heads/oc*" >actual && |
| 838 | test_cmp expect.decorate actual |
| 839 | ' |
| 840 | |
brian m. carlson | c74271a | 2017-05-14 18:00:58 +0000 | [diff] [blame] | 841 | test_expect_success 'log.decorate config parsing' ' |
| 842 | git log --oneline --decorate=full >expect.full && |
| 843 | git log --oneline --decorate=short >expect.short && |
| 844 | |
| 845 | test_config log.decorate full && |
| 846 | test_config log.mailmap true && |
| 847 | git log --oneline >actual && |
| 848 | test_cmp expect.full actual && |
| 849 | git log --oneline --decorate=short >actual && |
| 850 | test_cmp expect.short actual |
| 851 | ' |
| 852 | |
Alex Henrie | 940a911 | 2017-03-23 23:46:31 -0600 | [diff] [blame] | 853 | test_expect_success TTY 'log output on a TTY' ' |
Jeff King | e433749 | 2017-10-03 09:39:34 -0400 | [diff] [blame] | 854 | git log --color --oneline --decorate >expect.short && |
Alex Henrie | 940a911 | 2017-03-23 23:46:31 -0600 | [diff] [blame] | 855 | |
| 856 | test_terminal git log --oneline >actual && |
| 857 | test_cmp expect.short actual |
| 858 | ' |
| 859 | |
Jay Soffian | 0c47695 | 2011-05-18 13:56:04 -0400 | [diff] [blame] | 860 | test_expect_success 'reflog is expected format' ' |
Jay Soffian | 0c47695 | 2011-05-18 13:56:04 -0400 | [diff] [blame] | 861 | git log -g --abbrev-commit --pretty=oneline >expect && |
| 862 | git reflog >actual && |
| 863 | test_cmp expect actual |
| 864 | ' |
| 865 | |
| 866 | test_expect_success 'whatchanged is expected format' ' |
| 867 | git log --no-merges --raw >expect && |
| 868 | git whatchanged >actual && |
| 869 | test_cmp expect actual |
| 870 | ' |
| 871 | |
| 872 | test_expect_success 'log.abbrevCommit configuration' ' |
Jay Soffian | 0c47695 | 2011-05-18 13:56:04 -0400 | [diff] [blame] | 873 | git log --abbrev-commit >expect.log.abbrev && |
| 874 | git log --no-abbrev-commit >expect.log.full && |
| 875 | git log --pretty=raw >expect.log.raw && |
| 876 | git reflog --abbrev-commit >expect.reflog.abbrev && |
| 877 | git reflog --no-abbrev-commit >expect.reflog.full && |
| 878 | git whatchanged --abbrev-commit >expect.whatchanged.abbrev && |
| 879 | git whatchanged --no-abbrev-commit >expect.whatchanged.full && |
| 880 | |
Yann Droneaud | 90e76b7 | 2013-03-24 22:06:06 +0100 | [diff] [blame] | 881 | test_config log.abbrevCommit true && |
Jay Soffian | 0c47695 | 2011-05-18 13:56:04 -0400 | [diff] [blame] | 882 | |
| 883 | git log >actual && |
| 884 | test_cmp expect.log.abbrev actual && |
| 885 | git log --no-abbrev-commit >actual && |
| 886 | test_cmp expect.log.full actual && |
| 887 | |
| 888 | git log --pretty=raw >actual && |
| 889 | test_cmp expect.log.raw actual && |
| 890 | |
| 891 | git reflog >actual && |
| 892 | test_cmp expect.reflog.abbrev actual && |
| 893 | git reflog --no-abbrev-commit >actual && |
| 894 | test_cmp expect.reflog.full actual && |
| 895 | |
| 896 | git whatchanged >actual && |
| 897 | test_cmp expect.whatchanged.abbrev actual && |
| 898 | git whatchanged --no-abbrev-commit >actual && |
| 899 | test_cmp expect.whatchanged.full actual |
Junio C Hamano | 8a3d203 | 2010-02-17 10:20:49 -0800 | [diff] [blame] | 900 | ' |
| 901 | |
Ævar Arnfjörð Bjarmason | 6511312 | 2010-08-15 10:16:25 +0000 | [diff] [blame] | 902 | test_expect_success 'show added path under "--follow -M"' ' |
| 903 | # This tests for a regression introduced in v1.7.2-rc0~103^2~2 |
| 904 | test_create_repo regression && |
| 905 | ( |
| 906 | cd regression && |
| 907 | test_commit needs-another-commit && |
| 908 | test_commit foo.bar && |
| 909 | git log -M --follow -p foo.bar.t && |
| 910 | git log -M --follow --stat foo.bar.t && |
| 911 | git log -M --follow --name-only foo.bar.t |
| 912 | ) |
| 913 | ' |
Brandon Casey | c65233f | 2008-07-22 16:23:31 -0500 | [diff] [blame] | 914 | |
Clemens Buchacher | 46ec510 | 2013-05-28 00:49:57 +0200 | [diff] [blame] | 915 | test_expect_success 'git log -c --follow' ' |
| 916 | test_create_repo follow-c && |
| 917 | ( |
| 918 | cd follow-c && |
| 919 | test_commit initial file original && |
| 920 | git rm file && |
| 921 | test_commit rename file2 original && |
| 922 | git reset --hard initial && |
| 923 | test_commit modify file foo && |
| 924 | git merge -m merge rename && |
| 925 | git log -c --follow file2 |
| 926 | ) |
| 927 | ' |
| 928 | |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 929 | cat >expect <<\EOF |
| 930 | * commit COMMIT_OBJECT_NAME |
| 931 | |\ Merge: MERGE_PARENTS |
| 932 | | | Author: A U Thor <author@example.com> |
| 933 | | | |
| 934 | | | Merge HEADS DESCRIPTION |
| 935 | | | |
| 936 | | * commit COMMIT_OBJECT_NAME |
| 937 | | | Author: A U Thor <author@example.com> |
| 938 | | | |
| 939 | | | reach |
| 940 | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 941 | | | reach.t | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 942 | | | 1 file changed, 1 insertion(+) |
| 943 | | | |
| 944 | | | diff --git a/reach.t b/reach.t |
| 945 | | | new file mode 100644 |
| 946 | | | index 0000000..10c9591 |
| 947 | | | --- /dev/null |
| 948 | | | +++ b/reach.t |
| 949 | | | @@ -0,0 +1 @@ |
| 950 | | | +reach |
| 951 | | | |
| 952 | | \ |
| 953 | *-. \ commit COMMIT_OBJECT_NAME |
| 954 | |\ \ \ Merge: MERGE_PARENTS |
| 955 | | | | | Author: A U Thor <author@example.com> |
| 956 | | | | | |
| 957 | | | | | Merge HEADS DESCRIPTION |
| 958 | | | | | |
| 959 | | | * | commit COMMIT_OBJECT_NAME |
| 960 | | | |/ Author: A U Thor <author@example.com> |
| 961 | | | | |
| 962 | | | | octopus-b |
| 963 | | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 964 | | | | octopus-b.t | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 965 | | | | 1 file changed, 1 insertion(+) |
| 966 | | | | |
| 967 | | | | diff --git a/octopus-b.t b/octopus-b.t |
| 968 | | | | new file mode 100644 |
| 969 | | | | index 0000000..d5fcad0 |
| 970 | | | | --- /dev/null |
| 971 | | | | +++ b/octopus-b.t |
| 972 | | | | @@ -0,0 +1 @@ |
| 973 | | | | +octopus-b |
| 974 | | | | |
| 975 | | * | commit COMMIT_OBJECT_NAME |
| 976 | | |/ Author: A U Thor <author@example.com> |
| 977 | | | |
| 978 | | | octopus-a |
| 979 | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 980 | | | octopus-a.t | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 981 | | | 1 file changed, 1 insertion(+) |
| 982 | | | |
| 983 | | | diff --git a/octopus-a.t b/octopus-a.t |
| 984 | | | new file mode 100644 |
| 985 | | | index 0000000..11ee015 |
| 986 | | | --- /dev/null |
| 987 | | | +++ b/octopus-a.t |
| 988 | | | @@ -0,0 +1 @@ |
| 989 | | | +octopus-a |
| 990 | | | |
| 991 | * | commit COMMIT_OBJECT_NAME |
| 992 | |/ Author: A U Thor <author@example.com> |
| 993 | | |
| 994 | | seventh |
| 995 | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 996 | | seventh.t | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 997 | | 1 file changed, 1 insertion(+) |
| 998 | | |
| 999 | | diff --git a/seventh.t b/seventh.t |
| 1000 | | new file mode 100644 |
| 1001 | | index 0000000..9744ffc |
| 1002 | | --- /dev/null |
| 1003 | | +++ b/seventh.t |
| 1004 | | @@ -0,0 +1 @@ |
| 1005 | | +seventh |
| 1006 | | |
| 1007 | * commit COMMIT_OBJECT_NAME |
| 1008 | |\ Merge: MERGE_PARENTS |
| 1009 | | | Author: A U Thor <author@example.com> |
| 1010 | | | |
| 1011 | | | Merge branch 'tangle' |
| 1012 | | | |
| 1013 | | * commit COMMIT_OBJECT_NAME |
| 1014 | | |\ Merge: MERGE_PARENTS |
| 1015 | | | | Author: A U Thor <author@example.com> |
| 1016 | | | | |
| 1017 | | | | Merge branch 'side' (early part) into tangle |
| 1018 | | | | |
| 1019 | | * | commit COMMIT_OBJECT_NAME |
| 1020 | | |\ \ Merge: MERGE_PARENTS |
| 1021 | | | | | Author: A U Thor <author@example.com> |
| 1022 | | | | | |
| 1023 | | | | | Merge branch 'master' (early part) into tangle |
| 1024 | | | | | |
| 1025 | | * | | commit COMMIT_OBJECT_NAME |
| 1026 | | | | | Author: A U Thor <author@example.com> |
| 1027 | | | | | |
| 1028 | | | | | tangle-a |
| 1029 | | | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1030 | | | | | tangle-a | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1031 | | | | | 1 file changed, 1 insertion(+) |
| 1032 | | | | | |
| 1033 | | | | | diff --git a/tangle-a b/tangle-a |
| 1034 | | | | | new file mode 100644 |
| 1035 | | | | | index 0000000..7898192 |
| 1036 | | | | | --- /dev/null |
| 1037 | | | | | +++ b/tangle-a |
| 1038 | | | | | @@ -0,0 +1 @@ |
| 1039 | | | | | +a |
| 1040 | | | | | |
| 1041 | * | | | commit COMMIT_OBJECT_NAME |
| 1042 | |\ \ \ \ Merge: MERGE_PARENTS |
| 1043 | | | | | | Author: A U Thor <author@example.com> |
| 1044 | | | | | | |
| 1045 | | | | | | Merge branch 'side' |
| 1046 | | | | | | |
| 1047 | | * | | | commit COMMIT_OBJECT_NAME |
| 1048 | | | |_|/ Author: A U Thor <author@example.com> |
| 1049 | | |/| | |
| 1050 | | | | | side-2 |
| 1051 | | | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1052 | | | | | 2 | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1053 | | | | | 1 file changed, 1 insertion(+) |
| 1054 | | | | | |
| 1055 | | | | | diff --git a/2 b/2 |
| 1056 | | | | | new file mode 100644 |
| 1057 | | | | | index 0000000..0cfbf08 |
| 1058 | | | | | --- /dev/null |
| 1059 | | | | | +++ b/2 |
| 1060 | | | | | @@ -0,0 +1 @@ |
| 1061 | | | | | +2 |
| 1062 | | | | | |
| 1063 | | * | | commit COMMIT_OBJECT_NAME |
| 1064 | | | | | Author: A U Thor <author@example.com> |
| 1065 | | | | | |
| 1066 | | | | | side-1 |
| 1067 | | | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1068 | | | | | 1 | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1069 | | | | | 1 file changed, 1 insertion(+) |
| 1070 | | | | | |
| 1071 | | | | | diff --git a/1 b/1 |
| 1072 | | | | | new file mode 100644 |
| 1073 | | | | | index 0000000..d00491f |
| 1074 | | | | | --- /dev/null |
| 1075 | | | | | +++ b/1 |
| 1076 | | | | | @@ -0,0 +1 @@ |
| 1077 | | | | | +1 |
| 1078 | | | | | |
| 1079 | * | | | commit COMMIT_OBJECT_NAME |
| 1080 | | | | | Author: A U Thor <author@example.com> |
| 1081 | | | | | |
| 1082 | | | | | Second |
| 1083 | | | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1084 | | | | | one | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1085 | | | | | 1 file changed, 1 insertion(+) |
| 1086 | | | | | |
| 1087 | | | | | diff --git a/one b/one |
| 1088 | | | | | new file mode 100644 |
| 1089 | | | | | index 0000000..9a33383 |
| 1090 | | | | | --- /dev/null |
| 1091 | | | | | +++ b/one |
| 1092 | | | | | @@ -0,0 +1 @@ |
| 1093 | | | | | +case |
| 1094 | | | | | |
| 1095 | * | | | commit COMMIT_OBJECT_NAME |
| 1096 | | |_|/ Author: A U Thor <author@example.com> |
| 1097 | |/| | |
| 1098 | | | | sixth |
| 1099 | | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1100 | | | | a/two | 1 - |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1101 | | | | 1 file changed, 1 deletion(-) |
| 1102 | | | | |
| 1103 | | | | diff --git a/a/two b/a/two |
| 1104 | | | | deleted file mode 100644 |
| 1105 | | | | index 9245af5..0000000 |
| 1106 | | | | --- a/a/two |
| 1107 | | | | +++ /dev/null |
| 1108 | | | | @@ -1 +0,0 @@ |
| 1109 | | | | -ni |
| 1110 | | | | |
| 1111 | * | | commit COMMIT_OBJECT_NAME |
| 1112 | | | | Author: A U Thor <author@example.com> |
| 1113 | | | | |
| 1114 | | | | fifth |
| 1115 | | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1116 | | | | a/two | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1117 | | | | 1 file changed, 1 insertion(+) |
| 1118 | | | | |
| 1119 | | | | diff --git a/a/two b/a/two |
| 1120 | | | | new file mode 100644 |
| 1121 | | | | index 0000000..9245af5 |
| 1122 | | | | --- /dev/null |
| 1123 | | | | +++ b/a/two |
| 1124 | | | | @@ -0,0 +1 @@ |
| 1125 | | | | +ni |
| 1126 | | | | |
| 1127 | * | | commit COMMIT_OBJECT_NAME |
| 1128 | |/ / Author: A U Thor <author@example.com> |
| 1129 | | | |
| 1130 | | | fourth |
| 1131 | | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1132 | | | ein | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1133 | | | 1 file changed, 1 insertion(+) |
| 1134 | | | |
| 1135 | | | diff --git a/ein b/ein |
| 1136 | | | new file mode 100644 |
| 1137 | | | index 0000000..9d7e69f |
| 1138 | | | --- /dev/null |
| 1139 | | | +++ b/ein |
| 1140 | | | @@ -0,0 +1 @@ |
| 1141 | | | +ichi |
| 1142 | | | |
| 1143 | * | commit COMMIT_OBJECT_NAME |
| 1144 | |/ Author: A U Thor <author@example.com> |
| 1145 | | |
| 1146 | | third |
| 1147 | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1148 | | ichi | 1 + |
| 1149 | | one | 1 - |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1150 | | 2 files changed, 1 insertion(+), 1 deletion(-) |
| 1151 | | |
| 1152 | | diff --git a/ichi b/ichi |
| 1153 | | new file mode 100644 |
| 1154 | | index 0000000..9d7e69f |
| 1155 | | --- /dev/null |
| 1156 | | +++ b/ichi |
| 1157 | | @@ -0,0 +1 @@ |
| 1158 | | +ichi |
| 1159 | | diff --git a/one b/one |
| 1160 | | deleted file mode 100644 |
| 1161 | | index 9d7e69f..0000000 |
| 1162 | | --- a/one |
| 1163 | | +++ /dev/null |
| 1164 | | @@ -1 +0,0 @@ |
| 1165 | | -ichi |
| 1166 | | |
| 1167 | * commit COMMIT_OBJECT_NAME |
| 1168 | | Author: A U Thor <author@example.com> |
| 1169 | | |
| 1170 | | second |
| 1171 | | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1172 | | one | 2 +- |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1173 | | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 1174 | | |
| 1175 | | diff --git a/one b/one |
| 1176 | | index 5626abf..9d7e69f 100644 |
| 1177 | | --- a/one |
| 1178 | | +++ b/one |
| 1179 | | @@ -1 +1 @@ |
| 1180 | | -one |
| 1181 | | +ichi |
| 1182 | | |
| 1183 | * commit COMMIT_OBJECT_NAME |
| 1184 | Author: A U Thor <author@example.com> |
| 1185 | |
| 1186 | initial |
| 1187 | --- |
Zbigniew Jędrzejewski-Szmek | dc801e7 | 2012-04-30 22:38:58 +0200 | [diff] [blame] | 1188 | one | 1 + |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1189 | 1 file changed, 1 insertion(+) |
| 1190 | |
| 1191 | diff --git a/one b/one |
| 1192 | new file mode 100644 |
| 1193 | index 0000000..5626abf |
| 1194 | --- /dev/null |
| 1195 | +++ b/one |
| 1196 | @@ -0,0 +1 @@ |
| 1197 | +one |
| 1198 | EOF |
| 1199 | |
| 1200 | sanitize_output () { |
| 1201 | sed -e 's/ *$//' \ |
| 1202 | -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \ |
| 1203 | -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \ |
| 1204 | -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \ |
| 1205 | -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \ |
| 1206 | -e 's/, 0 deletions(-)//' \ |
| 1207 | -e 's/, 0 insertions(+)//' \ |
| 1208 | -e 's/ 1 files changed, / 1 file changed, /' \ |
| 1209 | -e 's/, 1 deletions(-)/, 1 deletion(-)/' \ |
| 1210 | -e 's/, 1 insertions(+)/, 1 insertion(+)/' |
| 1211 | } |
| 1212 | |
| 1213 | test_expect_success 'log --graph with diff and stats' ' |
Matthieu Moy | 5404c11 | 2016-02-25 09:59:21 +0100 | [diff] [blame] | 1214 | git log --no-renames --graph --pretty=short --stat -p >actual && |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1215 | sanitize_output >actual.sanitized <actual && |
Jiang Xin | b354f11 | 2012-08-27 13:36:51 +0800 | [diff] [blame] | 1216 | test_i18ncmp expect actual.sanitized |
Lucian Poston | e2c5966 | 2012-03-20 01:05:34 -0700 | [diff] [blame] | 1217 | ' |
| 1218 | |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 1219 | cat >expect <<\EOF |
| 1220 | *** * commit COMMIT_OBJECT_NAME |
| 1221 | *** |\ Merge: MERGE_PARENTS |
| 1222 | *** | | Author: A U Thor <author@example.com> |
| 1223 | *** | | |
| 1224 | *** | | Merge HEADS DESCRIPTION |
| 1225 | *** | | |
| 1226 | *** | * commit COMMIT_OBJECT_NAME |
| 1227 | *** | | Author: A U Thor <author@example.com> |
| 1228 | *** | | |
| 1229 | *** | | reach |
| 1230 | *** | | --- |
| 1231 | *** | | reach.t | 1 + |
| 1232 | *** | | 1 file changed, 1 insertion(+) |
| 1233 | *** | | |
| 1234 | *** | | diff --git a/reach.t b/reach.t |
| 1235 | *** | | new file mode 100644 |
| 1236 | *** | | index 0000000..10c9591 |
| 1237 | *** | | --- /dev/null |
| 1238 | *** | | +++ b/reach.t |
| 1239 | *** | | @@ -0,0 +1 @@ |
| 1240 | *** | | +reach |
| 1241 | *** | | |
| 1242 | *** | \ |
| 1243 | *** *-. \ commit COMMIT_OBJECT_NAME |
| 1244 | *** |\ \ \ Merge: MERGE_PARENTS |
| 1245 | *** | | | | Author: A U Thor <author@example.com> |
| 1246 | *** | | | | |
| 1247 | *** | | | | Merge HEADS DESCRIPTION |
| 1248 | *** | | | | |
| 1249 | *** | | * | commit COMMIT_OBJECT_NAME |
| 1250 | *** | | |/ Author: A U Thor <author@example.com> |
| 1251 | *** | | | |
| 1252 | *** | | | octopus-b |
| 1253 | *** | | | --- |
| 1254 | *** | | | octopus-b.t | 1 + |
| 1255 | *** | | | 1 file changed, 1 insertion(+) |
| 1256 | *** | | | |
| 1257 | *** | | | diff --git a/octopus-b.t b/octopus-b.t |
| 1258 | *** | | | new file mode 100644 |
| 1259 | *** | | | index 0000000..d5fcad0 |
| 1260 | *** | | | --- /dev/null |
| 1261 | *** | | | +++ b/octopus-b.t |
| 1262 | *** | | | @@ -0,0 +1 @@ |
| 1263 | *** | | | +octopus-b |
| 1264 | *** | | | |
| 1265 | *** | * | commit COMMIT_OBJECT_NAME |
| 1266 | *** | |/ Author: A U Thor <author@example.com> |
| 1267 | *** | | |
| 1268 | *** | | octopus-a |
| 1269 | *** | | --- |
| 1270 | *** | | octopus-a.t | 1 + |
| 1271 | *** | | 1 file changed, 1 insertion(+) |
| 1272 | *** | | |
| 1273 | *** | | diff --git a/octopus-a.t b/octopus-a.t |
| 1274 | *** | | new file mode 100644 |
| 1275 | *** | | index 0000000..11ee015 |
| 1276 | *** | | --- /dev/null |
| 1277 | *** | | +++ b/octopus-a.t |
| 1278 | *** | | @@ -0,0 +1 @@ |
| 1279 | *** | | +octopus-a |
| 1280 | *** | | |
| 1281 | *** * | commit COMMIT_OBJECT_NAME |
| 1282 | *** |/ Author: A U Thor <author@example.com> |
| 1283 | *** | |
| 1284 | *** | seventh |
| 1285 | *** | --- |
| 1286 | *** | seventh.t | 1 + |
| 1287 | *** | 1 file changed, 1 insertion(+) |
| 1288 | *** | |
| 1289 | *** | diff --git a/seventh.t b/seventh.t |
| 1290 | *** | new file mode 100644 |
| 1291 | *** | index 0000000..9744ffc |
| 1292 | *** | --- /dev/null |
| 1293 | *** | +++ b/seventh.t |
| 1294 | *** | @@ -0,0 +1 @@ |
| 1295 | *** | +seventh |
| 1296 | *** | |
| 1297 | *** * commit COMMIT_OBJECT_NAME |
| 1298 | *** |\ Merge: MERGE_PARENTS |
| 1299 | *** | | Author: A U Thor <author@example.com> |
| 1300 | *** | | |
| 1301 | *** | | Merge branch 'tangle' |
| 1302 | *** | | |
| 1303 | *** | * commit COMMIT_OBJECT_NAME |
| 1304 | *** | |\ Merge: MERGE_PARENTS |
| 1305 | *** | | | Author: A U Thor <author@example.com> |
| 1306 | *** | | | |
| 1307 | *** | | | Merge branch 'side' (early part) into tangle |
| 1308 | *** | | | |
| 1309 | *** | * | commit COMMIT_OBJECT_NAME |
| 1310 | *** | |\ \ Merge: MERGE_PARENTS |
| 1311 | *** | | | | Author: A U Thor <author@example.com> |
| 1312 | *** | | | | |
| 1313 | *** | | | | Merge branch 'master' (early part) into tangle |
| 1314 | *** | | | | |
| 1315 | *** | * | | commit COMMIT_OBJECT_NAME |
| 1316 | *** | | | | Author: A U Thor <author@example.com> |
| 1317 | *** | | | | |
| 1318 | *** | | | | tangle-a |
| 1319 | *** | | | | --- |
| 1320 | *** | | | | tangle-a | 1 + |
| 1321 | *** | | | | 1 file changed, 1 insertion(+) |
| 1322 | *** | | | | |
| 1323 | *** | | | | diff --git a/tangle-a b/tangle-a |
| 1324 | *** | | | | new file mode 100644 |
| 1325 | *** | | | | index 0000000..7898192 |
| 1326 | *** | | | | --- /dev/null |
| 1327 | *** | | | | +++ b/tangle-a |
| 1328 | *** | | | | @@ -0,0 +1 @@ |
| 1329 | *** | | | | +a |
| 1330 | *** | | | | |
| 1331 | *** * | | | commit COMMIT_OBJECT_NAME |
| 1332 | *** |\ \ \ \ Merge: MERGE_PARENTS |
| 1333 | *** | | | | | Author: A U Thor <author@example.com> |
| 1334 | *** | | | | | |
| 1335 | *** | | | | | Merge branch 'side' |
| 1336 | *** | | | | | |
| 1337 | *** | * | | | commit COMMIT_OBJECT_NAME |
| 1338 | *** | | |_|/ Author: A U Thor <author@example.com> |
| 1339 | *** | |/| | |
| 1340 | *** | | | | side-2 |
| 1341 | *** | | | | --- |
| 1342 | *** | | | | 2 | 1 + |
| 1343 | *** | | | | 1 file changed, 1 insertion(+) |
| 1344 | *** | | | | |
| 1345 | *** | | | | diff --git a/2 b/2 |
| 1346 | *** | | | | new file mode 100644 |
| 1347 | *** | | | | index 0000000..0cfbf08 |
| 1348 | *** | | | | --- /dev/null |
| 1349 | *** | | | | +++ b/2 |
| 1350 | *** | | | | @@ -0,0 +1 @@ |
| 1351 | *** | | | | +2 |
| 1352 | *** | | | | |
| 1353 | *** | * | | commit COMMIT_OBJECT_NAME |
| 1354 | *** | | | | Author: A U Thor <author@example.com> |
| 1355 | *** | | | | |
| 1356 | *** | | | | side-1 |
| 1357 | *** | | | | --- |
| 1358 | *** | | | | 1 | 1 + |
| 1359 | *** | | | | 1 file changed, 1 insertion(+) |
| 1360 | *** | | | | |
| 1361 | *** | | | | diff --git a/1 b/1 |
| 1362 | *** | | | | new file mode 100644 |
| 1363 | *** | | | | index 0000000..d00491f |
| 1364 | *** | | | | --- /dev/null |
| 1365 | *** | | | | +++ b/1 |
| 1366 | *** | | | | @@ -0,0 +1 @@ |
| 1367 | *** | | | | +1 |
| 1368 | *** | | | | |
| 1369 | *** * | | | commit COMMIT_OBJECT_NAME |
| 1370 | *** | | | | Author: A U Thor <author@example.com> |
| 1371 | *** | | | | |
| 1372 | *** | | | | Second |
| 1373 | *** | | | | --- |
| 1374 | *** | | | | one | 1 + |
| 1375 | *** | | | | 1 file changed, 1 insertion(+) |
| 1376 | *** | | | | |
| 1377 | *** | | | | diff --git a/one b/one |
| 1378 | *** | | | | new file mode 100644 |
| 1379 | *** | | | | index 0000000..9a33383 |
| 1380 | *** | | | | --- /dev/null |
| 1381 | *** | | | | +++ b/one |
| 1382 | *** | | | | @@ -0,0 +1 @@ |
| 1383 | *** | | | | +case |
| 1384 | *** | | | | |
| 1385 | *** * | | | commit COMMIT_OBJECT_NAME |
| 1386 | *** | |_|/ Author: A U Thor <author@example.com> |
| 1387 | *** |/| | |
| 1388 | *** | | | sixth |
| 1389 | *** | | | --- |
| 1390 | *** | | | a/two | 1 - |
| 1391 | *** | | | 1 file changed, 1 deletion(-) |
| 1392 | *** | | | |
| 1393 | *** | | | diff --git a/a/two b/a/two |
| 1394 | *** | | | deleted file mode 100644 |
| 1395 | *** | | | index 9245af5..0000000 |
| 1396 | *** | | | --- a/a/two |
| 1397 | *** | | | +++ /dev/null |
| 1398 | *** | | | @@ -1 +0,0 @@ |
| 1399 | *** | | | -ni |
| 1400 | *** | | | |
| 1401 | *** * | | commit COMMIT_OBJECT_NAME |
| 1402 | *** | | | Author: A U Thor <author@example.com> |
| 1403 | *** | | | |
| 1404 | *** | | | fifth |
| 1405 | *** | | | --- |
| 1406 | *** | | | a/two | 1 + |
| 1407 | *** | | | 1 file changed, 1 insertion(+) |
| 1408 | *** | | | |
| 1409 | *** | | | diff --git a/a/two b/a/two |
| 1410 | *** | | | new file mode 100644 |
| 1411 | *** | | | index 0000000..9245af5 |
| 1412 | *** | | | --- /dev/null |
| 1413 | *** | | | +++ b/a/two |
| 1414 | *** | | | @@ -0,0 +1 @@ |
| 1415 | *** | | | +ni |
| 1416 | *** | | | |
| 1417 | *** * | | commit COMMIT_OBJECT_NAME |
| 1418 | *** |/ / Author: A U Thor <author@example.com> |
| 1419 | *** | | |
| 1420 | *** | | fourth |
| 1421 | *** | | --- |
| 1422 | *** | | ein | 1 + |
| 1423 | *** | | 1 file changed, 1 insertion(+) |
| 1424 | *** | | |
| 1425 | *** | | diff --git a/ein b/ein |
| 1426 | *** | | new file mode 100644 |
| 1427 | *** | | index 0000000..9d7e69f |
| 1428 | *** | | --- /dev/null |
| 1429 | *** | | +++ b/ein |
| 1430 | *** | | @@ -0,0 +1 @@ |
| 1431 | *** | | +ichi |
| 1432 | *** | | |
| 1433 | *** * | commit COMMIT_OBJECT_NAME |
| 1434 | *** |/ Author: A U Thor <author@example.com> |
| 1435 | *** | |
| 1436 | *** | third |
| 1437 | *** | --- |
| 1438 | *** | ichi | 1 + |
| 1439 | *** | one | 1 - |
| 1440 | *** | 2 files changed, 1 insertion(+), 1 deletion(-) |
| 1441 | *** | |
| 1442 | *** | diff --git a/ichi b/ichi |
| 1443 | *** | new file mode 100644 |
| 1444 | *** | index 0000000..9d7e69f |
| 1445 | *** | --- /dev/null |
| 1446 | *** | +++ b/ichi |
| 1447 | *** | @@ -0,0 +1 @@ |
| 1448 | *** | +ichi |
| 1449 | *** | diff --git a/one b/one |
| 1450 | *** | deleted file mode 100644 |
| 1451 | *** | index 9d7e69f..0000000 |
| 1452 | *** | --- a/one |
| 1453 | *** | +++ /dev/null |
| 1454 | *** | @@ -1 +0,0 @@ |
| 1455 | *** | -ichi |
| 1456 | *** | |
| 1457 | *** * commit COMMIT_OBJECT_NAME |
| 1458 | *** | Author: A U Thor <author@example.com> |
| 1459 | *** | |
| 1460 | *** | second |
| 1461 | *** | --- |
| 1462 | *** | one | 2 +- |
| 1463 | *** | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 1464 | *** | |
| 1465 | *** | diff --git a/one b/one |
| 1466 | *** | index 5626abf..9d7e69f 100644 |
| 1467 | *** | --- a/one |
| 1468 | *** | +++ b/one |
| 1469 | *** | @@ -1 +1 @@ |
| 1470 | *** | -one |
| 1471 | *** | +ichi |
| 1472 | *** | |
| 1473 | *** * commit COMMIT_OBJECT_NAME |
| 1474 | *** Author: A U Thor <author@example.com> |
| 1475 | *** |
| 1476 | *** initial |
| 1477 | *** --- |
| 1478 | *** one | 1 + |
| 1479 | *** 1 file changed, 1 insertion(+) |
| 1480 | *** |
| 1481 | *** diff --git a/one b/one |
| 1482 | *** new file mode 100644 |
| 1483 | *** index 0000000..5626abf |
| 1484 | *** --- /dev/null |
| 1485 | *** +++ b/one |
| 1486 | *** @@ -0,0 +1 @@ |
| 1487 | *** +one |
| 1488 | EOF |
| 1489 | |
| 1490 | test_expect_success 'log --line-prefix="*** " --graph with diff and stats' ' |
| 1491 | git log --line-prefix="*** " --no-renames --graph --pretty=short --stat -p >actual && |
| 1492 | sanitize_output >actual.sanitized <actual && |
| 1493 | test_i18ncmp expect actual.sanitized |
| 1494 | ' |
| 1495 | |
Jeff King | f5022b5 | 2017-02-08 15:31:15 -0500 | [diff] [blame] | 1496 | cat >expect <<-\EOF |
| 1497 | * reach |
| 1498 | | |
| 1499 | | A reach.t |
| 1500 | * Merge branch 'tangle' |
| 1501 | * Merge branch 'side' |
| 1502 | |\ |
| 1503 | | * side-2 |
| 1504 | | |
| 1505 | | A 2 |
| 1506 | * Second |
| 1507 | | |
| 1508 | | A one |
| 1509 | * sixth |
| 1510 | |
| 1511 | D a/two |
| 1512 | EOF |
| 1513 | |
| 1514 | test_expect_success 'log --graph with --name-status' ' |
| 1515 | git log --graph --format=%s --name-status tangle..reach >actual && |
| 1516 | sanitize_output <actual >actual.sanitized && |
| 1517 | test_cmp expect actual.sanitized |
| 1518 | ' |
| 1519 | |
| 1520 | cat >expect <<-\EOF |
| 1521 | * reach |
| 1522 | | |
| 1523 | | reach.t |
| 1524 | * Merge branch 'tangle' |
| 1525 | * Merge branch 'side' |
| 1526 | |\ |
| 1527 | | * side-2 |
| 1528 | | |
| 1529 | | 2 |
| 1530 | * Second |
| 1531 | | |
| 1532 | | one |
| 1533 | * sixth |
| 1534 | |
| 1535 | a/two |
| 1536 | EOF |
| 1537 | |
| 1538 | test_expect_success 'log --graph with --name-only' ' |
| 1539 | git log --graph --format=%s --name-only tangle..reach >actual && |
| 1540 | sanitize_output <actual >actual.sanitized && |
| 1541 | test_cmp expect actual.sanitized |
| 1542 | ' |
| 1543 | |
Junio C Hamano | 003c84f | 2011-05-02 13:39:16 -0700 | [diff] [blame] | 1544 | test_expect_success 'dotdot is a parent directory' ' |
| 1545 | mkdir -p a/b && |
| 1546 | ( echo sixth && echo fifth ) >expect && |
| 1547 | ( cd a/b && git log --format=%s .. ) >actual && |
| 1548 | test_cmp expect actual |
| 1549 | ' |
| 1550 | |
Mehul Jain | aefc81a | 2016-06-24 19:42:34 +0530 | [diff] [blame] | 1551 | test_expect_success GPG 'setup signed branch' ' |
Zoltan Klinger | cf3983d | 2014-07-09 12:10:21 +1000 | [diff] [blame] | 1552 | test_when_finished "git reset --hard && git checkout master" && |
| 1553 | git checkout -b signed master && |
| 1554 | echo foo >foo && |
| 1555 | git add foo && |
Mehul Jain | aefc81a | 2016-06-24 19:42:34 +0530 | [diff] [blame] | 1556 | git commit -S -m signed_commit |
| 1557 | ' |
| 1558 | |
| 1559 | test_expect_success GPG 'log --graph --show-signature' ' |
Zoltan Klinger | cf3983d | 2014-07-09 12:10:21 +1000 | [diff] [blame] | 1560 | git log --graph --show-signature -n1 signed >actual && |
| 1561 | grep "^| gpg: Signature made" actual && |
| 1562 | grep "^| gpg: Good signature" actual |
| 1563 | ' |
| 1564 | |
| 1565 | test_expect_success GPG 'log --graph --show-signature for merged tag' ' |
| 1566 | test_when_finished "git reset --hard && git checkout master" && |
| 1567 | git checkout -b plain master && |
| 1568 | echo aaa >bar && |
| 1569 | git add bar && |
| 1570 | git commit -m bar_commit && |
| 1571 | git checkout -b tagged master && |
| 1572 | echo bbb >baz && |
| 1573 | git add baz && |
| 1574 | git commit -m baz_commit && |
| 1575 | git tag -s -m signed_tag_msg signed_tag && |
| 1576 | git checkout plain && |
| 1577 | git merge --no-ff -m msg signed_tag && |
| 1578 | git log --graph --show-signature -n1 plain >actual && |
| 1579 | grep "^|\\\ merged tag" actual && |
| 1580 | grep "^| | gpg: Signature made" actual && |
| 1581 | grep "^| | gpg: Good signature" actual |
| 1582 | ' |
| 1583 | |
Mehul Jain | aa37999 | 2016-06-22 22:21:25 +0530 | [diff] [blame] | 1584 | test_expect_success GPG '--no-show-signature overrides --show-signature' ' |
| 1585 | git log -1 --show-signature --no-show-signature signed >actual && |
| 1586 | ! grep "^gpg:" actual |
| 1587 | ' |
| 1588 | |
Mehul Jain | fce04c3 | 2016-06-22 22:21:26 +0530 | [diff] [blame] | 1589 | test_expect_success GPG 'log.showsignature=true behaves like --show-signature' ' |
| 1590 | test_config log.showsignature true && |
| 1591 | git log -1 signed >actual && |
| 1592 | grep "gpg: Signature made" actual && |
| 1593 | grep "gpg: Good signature" actual |
| 1594 | ' |
| 1595 | |
| 1596 | test_expect_success GPG '--no-show-signature overrides log.showsignature=true' ' |
| 1597 | test_config log.showsignature true && |
| 1598 | git log -1 --no-show-signature signed >actual && |
| 1599 | ! grep "^gpg:" actual |
| 1600 | ' |
| 1601 | |
| 1602 | test_expect_success GPG '--show-signature overrides log.showsignature=false' ' |
| 1603 | test_config log.showsignature false && |
| 1604 | git log -1 --show-signature signed >actual && |
| 1605 | grep "gpg: Signature made" actual && |
| 1606 | grep "gpg: Good signature" actual |
| 1607 | ' |
| 1608 | |
Dongcan Jiang | 695985f | 2015-03-11 10:13:02 +0800 | [diff] [blame] | 1609 | test_expect_success 'log --graph --no-walk is forbidden' ' |
| 1610 | test_must_fail git log --graph --no-walk |
| 1611 | ' |
| 1612 | |
Jeff King | ce11360 | 2015-08-29 01:04:18 -0400 | [diff] [blame] | 1613 | test_expect_success 'log diagnoses bogus HEAD' ' |
| 1614 | git init empty && |
| 1615 | test_must_fail git -C empty log 2>stderr && |
| 1616 | test_i18ngrep does.not.have.any.commits stderr && |
| 1617 | echo 1234abcd >empty/.git/refs/heads/master && |
| 1618 | test_must_fail git -C empty log 2>stderr && |
| 1619 | test_i18ngrep broken stderr && |
| 1620 | echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD && |
| 1621 | test_must_fail git -C empty log 2>stderr && |
| 1622 | test_i18ngrep broken stderr && |
| 1623 | test_must_fail git -C empty log --default totally-bogus 2>stderr && |
| 1624 | test_i18ngrep broken stderr |
| 1625 | ' |
| 1626 | |
Jeff King | 5d34d1a | 2017-08-02 18:30:19 -0400 | [diff] [blame] | 1627 | test_expect_success 'log does not default to HEAD when rev input is given' ' |
| 1628 | >expect && |
| 1629 | git log --branches=does-not-exist >actual && |
| 1630 | test_cmp expect actual |
| 1631 | ' |
| 1632 | |
Jeff King | 728350b | 2015-12-17 01:47:07 -0500 | [diff] [blame] | 1633 | test_expect_success 'set up --source tests' ' |
| 1634 | git checkout --orphan source-a && |
| 1635 | test_commit one && |
| 1636 | test_commit two && |
| 1637 | git checkout -b source-b HEAD^ && |
| 1638 | test_commit three |
| 1639 | ' |
| 1640 | |
| 1641 | test_expect_success 'log --source paints branch names' ' |
| 1642 | cat >expect <<-\EOF && |
| 1643 | 09e12a9 source-b three |
| 1644 | 8e393e1 source-a two |
| 1645 | 1ac6c77 source-b one |
| 1646 | EOF |
| 1647 | git log --oneline --source source-a source-b >actual && |
| 1648 | test_cmp expect actual |
| 1649 | ' |
| 1650 | |
| 1651 | test_expect_success 'log --source paints tag names' ' |
| 1652 | git tag -m tagged source-tag && |
| 1653 | cat >expect <<-\EOF && |
| 1654 | 09e12a9 source-tag three |
| 1655 | 8e393e1 source-a two |
| 1656 | 1ac6c77 source-tag one |
| 1657 | EOF |
| 1658 | git log --oneline --source source-tag source-a >actual && |
| 1659 | test_cmp expect actual |
| 1660 | ' |
| 1661 | |
Jeff King | ed79b2c | 2017-05-23 15:51:32 -0400 | [diff] [blame] | 1662 | test_expect_success 'log --source paints symmetric ranges' ' |
| 1663 | cat >expect <<-\EOF && |
| 1664 | 09e12a9 source-b three |
| 1665 | 8e393e1 source-a two |
| 1666 | EOF |
| 1667 | git log --oneline --source source-a...source-b >actual && |
| 1668 | test_cmp expect actual |
| 1669 | ' |
| 1670 | |
Matthew DeVore | 669b1d2 | 2018-10-22 18:13:42 -0700 | [diff] [blame^] | 1671 | test_expect_success '--exclude-promisor-objects does not BUG-crash' ' |
| 1672 | test_must_fail git log --exclude-promisor-objects source-a |
| 1673 | ' |
| 1674 | |
Ævar Arnfjörð Bjarmason | 6511312 | 2010-08-15 10:16:25 +0000 | [diff] [blame] | 1675 | test_done |