t / t4202-log.shon commit Merge branch 'mh/transport-capabilities' (be94b33)
   1#!/bin/sh
   2
   3test_description='git log'
   4
   5. ./test-lib.sh
   6. "$TEST_DIRECTORY/lib-gpg.sh"
   7
   8test_expect_success setup '
   9
  10        echo one >one &&
  11        git add one &&
  12        test_tick &&
  13        git commit -m initial &&
  14
  15        echo ichi >one &&
  16        git add one &&
  17        test_tick &&
  18        git commit -m second &&
  19
  20        git mv one ichi &&
  21        test_tick &&
  22        git commit -m third &&
  23
  24        cp ichi ein &&
  25        git add ein &&
  26        test_tick &&
  27        git commit -m fourth &&
  28
  29        mkdir a &&
  30        echo ni >a/two &&
  31        git add a/two &&
  32        test_tick &&
  33        git commit -m fifth  &&
  34
  35        git rm a/two &&
  36        test_tick &&
  37        git commit -m sixth
  38
  39'
  40
  41printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect
  42test_expect_success 'pretty' '
  43
  44        git log --pretty="format:%s" > actual &&
  45        test_cmp expect actual
  46'
  47
  48printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial\n" > expect
  49test_expect_success 'pretty (tformat)' '
  50
  51        git log --pretty="tformat:%s" > actual &&
  52        test_cmp expect actual
  53'
  54
  55test_expect_success 'pretty (shortcut)' '
  56
  57        git log --pretty="%s" > actual &&
  58        test_cmp expect actual
  59'
  60
  61test_expect_success 'format' '
  62
  63        git log --format="%s" > actual &&
  64        test_cmp expect actual
  65'
  66
  67cat > expect << EOF
  68 This is
  69  the sixth
  70  commit.
  71 This is
  72  the fifth
  73  commit.
  74EOF
  75
  76test_expect_success 'format %w(11,1,2)' '
  77
  78        git log -2 --format="%w(11,1,2)This is the %s commit." > actual &&
  79        test_cmp expect actual
  80'
  81
  82test_expect_success 'format %w(,1,2)' '
  83
  84        git log -2 --format="%w(,1,2)This is%nthe %s%ncommit." > actual &&
  85        test_cmp expect actual
  86'
  87
  88cat > expect << EOF
  89804a787 sixth
  90394ef78 fifth
  915d31159 fourth
  922fbe8c0 third
  93f7dab8e second
  943a2fdcb initial
  95EOF
  96test_expect_success 'oneline' '
  97
  98        git log --oneline > actual &&
  99        test_cmp expect actual
 100'
 101
 102test_expect_success 'diff-filter=A' '
 103
 104        git log --pretty="format:%s" --diff-filter=A HEAD > actual &&
 105        git log --pretty="format:%s" --diff-filter A HEAD > actual-separate &&
 106        printf "fifth\nfourth\nthird\ninitial" > expect &&
 107        test_cmp expect actual &&
 108        test_cmp expect actual-separate
 109
 110'
 111
 112test_expect_success 'diff-filter=M' '
 113
 114        actual=$(git log --pretty="format:%s" --diff-filter=M HEAD) &&
 115        expect=$(echo second) &&
 116        test "$actual" = "$expect" || {
 117                echo Oops
 118                echo "Actual: $actual"
 119                false
 120        }
 121
 122'
 123
 124test_expect_success 'diff-filter=D' '
 125
 126        actual=$(git log --pretty="format:%s" --diff-filter=D HEAD) &&
 127        expect=$(echo sixth ; echo third) &&
 128        test "$actual" = "$expect" || {
 129                echo Oops
 130                echo "Actual: $actual"
 131                false
 132        }
 133
 134'
 135
 136test_expect_success 'diff-filter=R' '
 137
 138        actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) &&
 139        expect=$(echo third) &&
 140        test "$actual" = "$expect" || {
 141                echo Oops
 142                echo "Actual: $actual"
 143                false
 144        }
 145
 146'
 147
 148test_expect_success 'diff-filter=C' '
 149
 150        actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) &&
 151        expect=$(echo fourth) &&
 152        test "$actual" = "$expect" || {
 153                echo Oops
 154                echo "Actual: $actual"
 155                false
 156        }
 157
 158'
 159
 160test_expect_success 'git log --follow' '
 161
 162        actual=$(git log --follow --pretty="format:%s" ichi) &&
 163        expect=$(echo third ; echo second ; echo initial) &&
 164        test "$actual" = "$expect" || {
 165                echo Oops
 166                echo "Actual: $actual"
 167                false
 168        }
 169
 170'
 171
 172cat > expect << EOF
 173804a787 sixth
 174394ef78 fifth
 1755d31159 fourth
 176EOF
 177test_expect_success 'git log --no-walk <commits> sorts by commit time' '
 178        git log --no-walk --oneline 5d31159 804a787 394ef78 > actual &&
 179        test_cmp expect actual
 180'
 181
 182test_expect_success 'git log --no-walk=sorted <commits> sorts by commit time' '
 183        git log --no-walk=sorted --oneline 5d31159 804a787 394ef78 > actual &&
 184        test_cmp expect actual
 185'
 186
 187cat > expect << EOF
 1885d31159 fourth
 189804a787 sixth
 190394ef78 fifth
 191EOF
 192test_expect_success 'git log --no-walk=unsorted <commits> leaves list of commits as given' '
 193        git log --no-walk=unsorted --oneline 5d31159 804a787 394ef78 > actual &&
 194        test_cmp expect actual
 195'
 196
 197test_expect_success 'git show <commits> leaves list of commits as given' '
 198        git show --oneline -s 5d31159 804a787 394ef78 > actual &&
 199        test_cmp expect actual
 200'
 201
 202test_expect_success 'setup case sensitivity tests' '
 203        echo case >one &&
 204        test_tick &&
 205        git add one &&
 206        git commit -a -m Second
 207'
 208
 209test_expect_success 'log --grep' '
 210        echo second >expect &&
 211        git log -1 --pretty="tformat:%s" --grep=sec >actual &&
 212        test_cmp expect actual
 213'
 214
 215cat > expect << EOF
 216second
 217initial
 218EOF
 219test_expect_success 'log --invert-grep --grep' '
 220        git log --pretty="tformat:%s" --invert-grep --grep=th --grep=Sec >actual &&
 221        test_cmp expect actual
 222'
 223
 224test_expect_success 'log --invert-grep --grep -i' '
 225        echo initial >expect &&
 226        git log --pretty="tformat:%s" --invert-grep -i --grep=th --grep=Sec >actual &&
 227        test_cmp expect actual
 228'
 229
 230test_expect_success 'log --grep option parsing' '
 231        echo second >expect &&
 232        git log -1 --pretty="tformat:%s" --grep sec >actual &&
 233        test_cmp expect actual &&
 234        test_must_fail git log -1 --pretty="tformat:%s" --grep
 235'
 236
 237test_expect_success 'log -i --grep' '
 238        echo Second >expect &&
 239        git log -1 --pretty="tformat:%s" -i --grep=sec >actual &&
 240        test_cmp expect actual
 241'
 242
 243test_expect_success 'log --grep -i' '
 244        echo Second >expect &&
 245        git log -1 --pretty="tformat:%s" --grep=sec -i >actual &&
 246        test_cmp expect actual
 247'
 248
 249test_expect_success 'log -F -E --grep=<ere> uses ere' '
 250        echo second >expect &&
 251        git log -1 --pretty="tformat:%s" -F -E --grep=s.c.nd >actual &&
 252        test_cmp expect actual
 253'
 254
 255cat > expect <<EOF
 256* Second
 257* sixth
 258* fifth
 259* fourth
 260* third
 261* second
 262* initial
 263EOF
 264
 265test_expect_success 'simple log --graph' '
 266        git log --graph --pretty=tformat:%s >actual &&
 267        test_cmp expect actual
 268'
 269
 270test_expect_success 'set up merge history' '
 271        git checkout -b side HEAD~4 &&
 272        test_commit side-1 1 1 &&
 273        test_commit side-2 2 2 &&
 274        git checkout master &&
 275        git merge side
 276'
 277
 278cat > expect <<\EOF
 279*   Merge branch 'side'
 280|\
 281| * side-2
 282| * side-1
 283* | Second
 284* | sixth
 285* | fifth
 286* | fourth
 287|/
 288* third
 289* second
 290* initial
 291EOF
 292
 293test_expect_success 'log --graph with merge' '
 294        git log --graph --date-order --pretty=tformat:%s |
 295                sed "s/ *\$//" >actual &&
 296        test_cmp expect actual
 297'
 298
 299test_expect_success 'log --raw --graph -m with merge' '
 300        git log --raw --graph --oneline -m master | head -n 500 >actual &&
 301        grep "initial" actual
 302'
 303
 304test_expect_success 'diff-tree --graph' '
 305        git diff-tree --graph master^ | head -n 500 >actual &&
 306        grep "one" actual
 307'
 308
 309cat > expect <<\EOF
 310*   commit master
 311|\  Merge: A B
 312| | Author: A U Thor <author@example.com>
 313| |
 314| |     Merge branch 'side'
 315| |
 316| * commit side
 317| | Author: A U Thor <author@example.com>
 318| |
 319| |     side-2
 320| |
 321| * commit tags/side-1
 322| | Author: A U Thor <author@example.com>
 323| |
 324| |     side-1
 325| |
 326* | commit master~1
 327| | Author: A U Thor <author@example.com>
 328| |
 329| |     Second
 330| |
 331* | commit master~2
 332| | Author: A U Thor <author@example.com>
 333| |
 334| |     sixth
 335| |
 336* | commit master~3
 337| | Author: A U Thor <author@example.com>
 338| |
 339| |     fifth
 340| |
 341* | commit master~4
 342|/  Author: A U Thor <author@example.com>
 343|
 344|       fourth
 345|
 346* commit tags/side-1~1
 347| Author: A U Thor <author@example.com>
 348|
 349|     third
 350|
 351* commit tags/side-1~2
 352| Author: A U Thor <author@example.com>
 353|
 354|     second
 355|
 356* commit tags/side-1~3
 357  Author: A U Thor <author@example.com>
 358
 359      initial
 360EOF
 361
 362test_expect_success 'log --graph with full output' '
 363        git log --graph --date-order --pretty=short |
 364                git name-rev --name-only --stdin |
 365                sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual &&
 366        test_cmp expect actual
 367'
 368
 369test_expect_success 'set up more tangled history' '
 370        git checkout -b tangle HEAD~6 &&
 371        test_commit tangle-a tangle-a a &&
 372        git merge master~3 &&
 373        git merge side~1 &&
 374        git checkout master &&
 375        git merge tangle &&
 376        git checkout -b reach &&
 377        test_commit reach &&
 378        git checkout master &&
 379        git checkout -b octopus-a &&
 380        test_commit octopus-a &&
 381        git checkout master &&
 382        git checkout -b octopus-b &&
 383        test_commit octopus-b &&
 384        git checkout master &&
 385        test_commit seventh &&
 386        git merge octopus-a octopus-b &&
 387        git merge reach
 388'
 389
 390cat > expect <<\EOF
 391*   Merge tag 'reach'
 392|\
 393| \
 394|  \
 395*-. \   Merge tags 'octopus-a' and 'octopus-b'
 396|\ \ \
 397* | | | seventh
 398| | * | octopus-b
 399| |/ /
 400|/| |
 401| * | octopus-a
 402|/ /
 403| * reach
 404|/
 405*   Merge branch 'tangle'
 406|\
 407| *   Merge branch 'side' (early part) into tangle
 408| |\
 409| * \   Merge branch 'master' (early part) into tangle
 410| |\ \
 411| * | | tangle-a
 412* | | |   Merge branch 'side'
 413|\ \ \ \
 414| * | | | side-2
 415| | |_|/
 416| |/| |
 417| * | | side-1
 418* | | | Second
 419* | | | sixth
 420| |_|/
 421|/| |
 422* | | fifth
 423* | | fourth
 424|/ /
 425* | third
 426|/
 427* second
 428* initial
 429EOF
 430
 431test_expect_success 'log --graph with merge' '
 432        git log --graph --date-order --pretty=tformat:%s |
 433                sed "s/ *\$//" >actual &&
 434        test_cmp expect actual
 435'
 436
 437test_expect_success 'log.decorate configuration' '
 438        git log --oneline >expect.none &&
 439        git log --oneline --decorate >expect.short &&
 440        git log --oneline --decorate=full >expect.full &&
 441
 442        echo "[log] decorate" >>.git/config &&
 443        git log --oneline >actual &&
 444        test_cmp expect.short actual &&
 445
 446        test_config log.decorate true &&
 447        git log --oneline >actual &&
 448        test_cmp expect.short actual &&
 449        git log --oneline --decorate=full >actual &&
 450        test_cmp expect.full actual &&
 451        git log --oneline --decorate=no >actual &&
 452        test_cmp expect.none actual &&
 453
 454        test_config log.decorate no &&
 455        git log --oneline >actual &&
 456        test_cmp expect.none actual &&
 457        git log --oneline --decorate >actual &&
 458        test_cmp expect.short actual &&
 459        git log --oneline --decorate=full >actual &&
 460        test_cmp expect.full actual &&
 461
 462        test_config log.decorate 1 &&
 463        git log --oneline >actual &&
 464        test_cmp expect.short actual &&
 465        git log --oneline --decorate=full >actual &&
 466        test_cmp expect.full actual &&
 467        git log --oneline --decorate=no >actual &&
 468        test_cmp expect.none actual &&
 469
 470        test_config log.decorate short &&
 471        git log --oneline >actual &&
 472        test_cmp expect.short actual &&
 473        git log --oneline --no-decorate >actual &&
 474        test_cmp expect.none actual &&
 475        git log --oneline --decorate=full >actual &&
 476        test_cmp expect.full actual &&
 477
 478        test_config log.decorate full &&
 479        git log --oneline >actual &&
 480        test_cmp expect.full actual &&
 481        git log --oneline --no-decorate >actual &&
 482        test_cmp expect.none actual &&
 483        git log --oneline --decorate >actual &&
 484        test_cmp expect.short actual
 485
 486        test_unconfig log.decorate &&
 487        git log --pretty=raw >expect.raw &&
 488        test_config log.decorate full &&
 489        git log --pretty=raw >actual &&
 490        test_cmp expect.raw actual
 491
 492'
 493
 494test_expect_success 'reflog is expected format' '
 495        git log -g --abbrev-commit --pretty=oneline >expect &&
 496        git reflog >actual &&
 497        test_cmp expect actual
 498'
 499
 500test_expect_success 'whatchanged is expected format' '
 501        git log --no-merges --raw >expect &&
 502        git whatchanged >actual &&
 503        test_cmp expect actual
 504'
 505
 506test_expect_success 'log.abbrevCommit configuration' '
 507        git log --abbrev-commit >expect.log.abbrev &&
 508        git log --no-abbrev-commit >expect.log.full &&
 509        git log --pretty=raw >expect.log.raw &&
 510        git reflog --abbrev-commit >expect.reflog.abbrev &&
 511        git reflog --no-abbrev-commit >expect.reflog.full &&
 512        git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
 513        git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
 514
 515        test_config log.abbrevCommit true &&
 516
 517        git log >actual &&
 518        test_cmp expect.log.abbrev actual &&
 519        git log --no-abbrev-commit >actual &&
 520        test_cmp expect.log.full actual &&
 521
 522        git log --pretty=raw >actual &&
 523        test_cmp expect.log.raw actual &&
 524
 525        git reflog >actual &&
 526        test_cmp expect.reflog.abbrev actual &&
 527        git reflog --no-abbrev-commit >actual &&
 528        test_cmp expect.reflog.full actual &&
 529
 530        git whatchanged >actual &&
 531        test_cmp expect.whatchanged.abbrev actual &&
 532        git whatchanged --no-abbrev-commit >actual &&
 533        test_cmp expect.whatchanged.full actual
 534'
 535
 536test_expect_success 'show added path under "--follow -M"' '
 537        # This tests for a regression introduced in v1.7.2-rc0~103^2~2
 538        test_create_repo regression &&
 539        (
 540                cd regression &&
 541                test_commit needs-another-commit &&
 542                test_commit foo.bar &&
 543                git log -M --follow -p foo.bar.t &&
 544                git log -M --follow --stat foo.bar.t &&
 545                git log -M --follow --name-only foo.bar.t
 546        )
 547'
 548
 549test_expect_success 'git log -c --follow' '
 550        test_create_repo follow-c &&
 551        (
 552                cd follow-c &&
 553                test_commit initial file original &&
 554                git rm file &&
 555                test_commit rename file2 original &&
 556                git reset --hard initial &&
 557                test_commit modify file foo &&
 558                git merge -m merge rename &&
 559                git log -c --follow file2
 560        )
 561'
 562
 563cat >expect <<\EOF
 564*   commit COMMIT_OBJECT_NAME
 565|\  Merge: MERGE_PARENTS
 566| | Author: A U Thor <author@example.com>
 567| |
 568| |     Merge HEADS DESCRIPTION
 569| |
 570| * commit COMMIT_OBJECT_NAME
 571| | Author: A U Thor <author@example.com>
 572| |
 573| |     reach
 574| | ---
 575| |  reach.t | 1 +
 576| |  1 file changed, 1 insertion(+)
 577| |
 578| | diff --git a/reach.t b/reach.t
 579| | new file mode 100644
 580| | index 0000000..10c9591
 581| | --- /dev/null
 582| | +++ b/reach.t
 583| | @@ -0,0 +1 @@
 584| | +reach
 585| |
 586|  \
 587*-. \   commit COMMIT_OBJECT_NAME
 588|\ \ \  Merge: MERGE_PARENTS
 589| | | | Author: A U Thor <author@example.com>
 590| | | |
 591| | | |     Merge HEADS DESCRIPTION
 592| | | |
 593| | * | commit COMMIT_OBJECT_NAME
 594| | |/  Author: A U Thor <author@example.com>
 595| | |
 596| | |       octopus-b
 597| | |   ---
 598| | |    octopus-b.t | 1 +
 599| | |    1 file changed, 1 insertion(+)
 600| | |
 601| | |   diff --git a/octopus-b.t b/octopus-b.t
 602| | |   new file mode 100644
 603| | |   index 0000000..d5fcad0
 604| | |   --- /dev/null
 605| | |   +++ b/octopus-b.t
 606| | |   @@ -0,0 +1 @@
 607| | |   +octopus-b
 608| | |
 609| * | commit COMMIT_OBJECT_NAME
 610| |/  Author: A U Thor <author@example.com>
 611| |
 612| |       octopus-a
 613| |   ---
 614| |    octopus-a.t | 1 +
 615| |    1 file changed, 1 insertion(+)
 616| |
 617| |   diff --git a/octopus-a.t b/octopus-a.t
 618| |   new file mode 100644
 619| |   index 0000000..11ee015
 620| |   --- /dev/null
 621| |   +++ b/octopus-a.t
 622| |   @@ -0,0 +1 @@
 623| |   +octopus-a
 624| |
 625* | commit COMMIT_OBJECT_NAME
 626|/  Author: A U Thor <author@example.com>
 627|
 628|       seventh
 629|   ---
 630|    seventh.t | 1 +
 631|    1 file changed, 1 insertion(+)
 632|
 633|   diff --git a/seventh.t b/seventh.t
 634|   new file mode 100644
 635|   index 0000000..9744ffc
 636|   --- /dev/null
 637|   +++ b/seventh.t
 638|   @@ -0,0 +1 @@
 639|   +seventh
 640|
 641*   commit COMMIT_OBJECT_NAME
 642|\  Merge: MERGE_PARENTS
 643| | Author: A U Thor <author@example.com>
 644| |
 645| |     Merge branch 'tangle'
 646| |
 647| *   commit COMMIT_OBJECT_NAME
 648| |\  Merge: MERGE_PARENTS
 649| | | Author: A U Thor <author@example.com>
 650| | |
 651| | |     Merge branch 'side' (early part) into tangle
 652| | |
 653| * |   commit COMMIT_OBJECT_NAME
 654| |\ \  Merge: MERGE_PARENTS
 655| | | | Author: A U Thor <author@example.com>
 656| | | |
 657| | | |     Merge branch 'master' (early part) into tangle
 658| | | |
 659| * | | commit COMMIT_OBJECT_NAME
 660| | | | Author: A U Thor <author@example.com>
 661| | | |
 662| | | |     tangle-a
 663| | | | ---
 664| | | |  tangle-a | 1 +
 665| | | |  1 file changed, 1 insertion(+)
 666| | | |
 667| | | | diff --git a/tangle-a b/tangle-a
 668| | | | new file mode 100644
 669| | | | index 0000000..7898192
 670| | | | --- /dev/null
 671| | | | +++ b/tangle-a
 672| | | | @@ -0,0 +1 @@
 673| | | | +a
 674| | | |
 675* | | |   commit COMMIT_OBJECT_NAME
 676|\ \ \ \  Merge: MERGE_PARENTS
 677| | | | | Author: A U Thor <author@example.com>
 678| | | | |
 679| | | | |     Merge branch 'side'
 680| | | | |
 681| * | | | commit COMMIT_OBJECT_NAME
 682| | |_|/  Author: A U Thor <author@example.com>
 683| |/| |
 684| | | |       side-2
 685| | | |   ---
 686| | | |    2 | 1 +
 687| | | |    1 file changed, 1 insertion(+)
 688| | | |
 689| | | |   diff --git a/2 b/2
 690| | | |   new file mode 100644
 691| | | |   index 0000000..0cfbf08
 692| | | |   --- /dev/null
 693| | | |   +++ b/2
 694| | | |   @@ -0,0 +1 @@
 695| | | |   +2
 696| | | |
 697| * | | commit COMMIT_OBJECT_NAME
 698| | | | Author: A U Thor <author@example.com>
 699| | | |
 700| | | |     side-1
 701| | | | ---
 702| | | |  1 | 1 +
 703| | | |  1 file changed, 1 insertion(+)
 704| | | |
 705| | | | diff --git a/1 b/1
 706| | | | new file mode 100644
 707| | | | index 0000000..d00491f
 708| | | | --- /dev/null
 709| | | | +++ b/1
 710| | | | @@ -0,0 +1 @@
 711| | | | +1
 712| | | |
 713* | | | commit COMMIT_OBJECT_NAME
 714| | | | Author: A U Thor <author@example.com>
 715| | | |
 716| | | |     Second
 717| | | | ---
 718| | | |  one | 1 +
 719| | | |  1 file changed, 1 insertion(+)
 720| | | |
 721| | | | diff --git a/one b/one
 722| | | | new file mode 100644
 723| | | | index 0000000..9a33383
 724| | | | --- /dev/null
 725| | | | +++ b/one
 726| | | | @@ -0,0 +1 @@
 727| | | | +case
 728| | | |
 729* | | | commit COMMIT_OBJECT_NAME
 730| |_|/  Author: A U Thor <author@example.com>
 731|/| |
 732| | |       sixth
 733| | |   ---
 734| | |    a/two | 1 -
 735| | |    1 file changed, 1 deletion(-)
 736| | |
 737| | |   diff --git a/a/two b/a/two
 738| | |   deleted file mode 100644
 739| | |   index 9245af5..0000000
 740| | |   --- a/a/two
 741| | |   +++ /dev/null
 742| | |   @@ -1 +0,0 @@
 743| | |   -ni
 744| | |
 745* | | commit COMMIT_OBJECT_NAME
 746| | | Author: A U Thor <author@example.com>
 747| | |
 748| | |     fifth
 749| | | ---
 750| | |  a/two | 1 +
 751| | |  1 file changed, 1 insertion(+)
 752| | |
 753| | | diff --git a/a/two b/a/two
 754| | | new file mode 100644
 755| | | index 0000000..9245af5
 756| | | --- /dev/null
 757| | | +++ b/a/two
 758| | | @@ -0,0 +1 @@
 759| | | +ni
 760| | |
 761* | | commit COMMIT_OBJECT_NAME
 762|/ /  Author: A U Thor <author@example.com>
 763| |
 764| |       fourth
 765| |   ---
 766| |    ein | 1 +
 767| |    1 file changed, 1 insertion(+)
 768| |
 769| |   diff --git a/ein b/ein
 770| |   new file mode 100644
 771| |   index 0000000..9d7e69f
 772| |   --- /dev/null
 773| |   +++ b/ein
 774| |   @@ -0,0 +1 @@
 775| |   +ichi
 776| |
 777* | commit COMMIT_OBJECT_NAME
 778|/  Author: A U Thor <author@example.com>
 779|
 780|       third
 781|   ---
 782|    ichi | 1 +
 783|    one  | 1 -
 784|    2 files changed, 1 insertion(+), 1 deletion(-)
 785|
 786|   diff --git a/ichi b/ichi
 787|   new file mode 100644
 788|   index 0000000..9d7e69f
 789|   --- /dev/null
 790|   +++ b/ichi
 791|   @@ -0,0 +1 @@
 792|   +ichi
 793|   diff --git a/one b/one
 794|   deleted file mode 100644
 795|   index 9d7e69f..0000000
 796|   --- a/one
 797|   +++ /dev/null
 798|   @@ -1 +0,0 @@
 799|   -ichi
 800|
 801* commit COMMIT_OBJECT_NAME
 802| Author: A U Thor <author@example.com>
 803|
 804|     second
 805| ---
 806|  one | 2 +-
 807|  1 file changed, 1 insertion(+), 1 deletion(-)
 808|
 809| diff --git a/one b/one
 810| index 5626abf..9d7e69f 100644
 811| --- a/one
 812| +++ b/one
 813| @@ -1 +1 @@
 814| -one
 815| +ichi
 816|
 817* commit COMMIT_OBJECT_NAME
 818  Author: A U Thor <author@example.com>
 819
 820      initial
 821  ---
 822   one | 1 +
 823   1 file changed, 1 insertion(+)
 824
 825  diff --git a/one b/one
 826  new file mode 100644
 827  index 0000000..5626abf
 828  --- /dev/null
 829  +++ b/one
 830  @@ -0,0 +1 @@
 831  +one
 832EOF
 833
 834sanitize_output () {
 835        sed -e 's/ *$//' \
 836            -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
 837            -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
 838            -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \
 839            -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \
 840            -e 's/, 0 deletions(-)//' \
 841            -e 's/, 0 insertions(+)//' \
 842            -e 's/ 1 files changed, / 1 file changed, /' \
 843            -e 's/, 1 deletions(-)/, 1 deletion(-)/' \
 844            -e 's/, 1 insertions(+)/, 1 insertion(+)/'
 845}
 846
 847test_expect_success 'log --graph with diff and stats' '
 848        git log --graph --pretty=short --stat -p >actual &&
 849        sanitize_output >actual.sanitized <actual &&
 850        test_i18ncmp expect actual.sanitized
 851'
 852
 853test_expect_success 'dotdot is a parent directory' '
 854        mkdir -p a/b &&
 855        ( echo sixth && echo fifth ) >expect &&
 856        ( cd a/b && git log --format=%s .. ) >actual &&
 857        test_cmp expect actual
 858'
 859
 860test_expect_success GPG 'log --graph --show-signature' '
 861        test_when_finished "git reset --hard && git checkout master" &&
 862        git checkout -b signed master &&
 863        echo foo >foo &&
 864        git add foo &&
 865        git commit -S -m signed_commit &&
 866        git log --graph --show-signature -n1 signed >actual &&
 867        grep "^| gpg: Signature made" actual &&
 868        grep "^| gpg: Good signature" actual
 869'
 870
 871test_expect_success GPG 'log --graph --show-signature for merged tag' '
 872        test_when_finished "git reset --hard && git checkout master" &&
 873        git checkout -b plain master &&
 874        echo aaa >bar &&
 875        git add bar &&
 876        git commit -m bar_commit &&
 877        git checkout -b tagged master &&
 878        echo bbb >baz &&
 879        git add baz &&
 880        git commit -m baz_commit &&
 881        git tag -s -m signed_tag_msg signed_tag &&
 882        git checkout plain &&
 883        git merge --no-ff -m msg signed_tag &&
 884        git log --graph --show-signature -n1 plain >actual &&
 885        grep "^|\\\  merged tag" actual &&
 886        grep "^| | gpg: Signature made" actual &&
 887        grep "^| | gpg: Good signature" actual
 888'
 889
 890test_done