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