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