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