t / t4202-log.shon commit Documentation/git-bisect.txt: git bisect term → git bisect terms (bbd374d)
   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        verbose test "$actual" = "$expect"
 117
 118'
 119
 120test_expect_success 'diff-filter=D' '
 121
 122        actual=$(git log --pretty="format:%s" --diff-filter=D HEAD) &&
 123        expect=$(echo sixth ; echo third) &&
 124        verbose test "$actual" = "$expect"
 125
 126'
 127
 128test_expect_success 'diff-filter=R' '
 129
 130        actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) &&
 131        expect=$(echo third) &&
 132        verbose test "$actual" = "$expect"
 133
 134'
 135
 136test_expect_success 'diff-filter=C' '
 137
 138        actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) &&
 139        expect=$(echo fourth) &&
 140        verbose test "$actual" = "$expect"
 141
 142'
 143
 144test_expect_success 'git log --follow' '
 145
 146        actual=$(git log --follow --pretty="format:%s" ichi) &&
 147        expect=$(echo third ; echo second ; echo initial) &&
 148        verbose test "$actual" = "$expect"
 149
 150'
 151
 152cat > expect << EOF
 153804a787 sixth
 154394ef78 fifth
 1555d31159 fourth
 156EOF
 157test_expect_success 'git log --no-walk <commits> sorts by commit time' '
 158        git log --no-walk --oneline 5d31159 804a787 394ef78 > actual &&
 159        test_cmp expect actual
 160'
 161
 162test_expect_success 'git log --no-walk=sorted <commits> sorts by commit time' '
 163        git log --no-walk=sorted --oneline 5d31159 804a787 394ef78 > actual &&
 164        test_cmp expect actual
 165'
 166
 167cat > expect << EOF
 1685d31159 fourth
 169804a787 sixth
 170394ef78 fifth
 171EOF
 172test_expect_success 'git log --no-walk=unsorted <commits> leaves list of commits as given' '
 173        git log --no-walk=unsorted --oneline 5d31159 804a787 394ef78 > actual &&
 174        test_cmp expect actual
 175'
 176
 177test_expect_success 'git show <commits> leaves list of commits as given' '
 178        git show --oneline -s 5d31159 804a787 394ef78 > actual &&
 179        test_cmp expect actual
 180'
 181
 182test_expect_success 'setup case sensitivity tests' '
 183        echo case >one &&
 184        test_tick &&
 185        git add one &&
 186        git commit -a -m Second
 187'
 188
 189test_expect_success 'log --grep' '
 190        echo second >expect &&
 191        git log -1 --pretty="tformat:%s" --grep=sec >actual &&
 192        test_cmp expect actual
 193'
 194
 195cat > expect << EOF
 196second
 197initial
 198EOF
 199test_expect_success 'log --invert-grep --grep' '
 200        git log --pretty="tformat:%s" --invert-grep --grep=th --grep=Sec >actual &&
 201        test_cmp expect actual
 202'
 203
 204test_expect_success 'log --invert-grep --grep -i' '
 205        echo initial >expect &&
 206        git log --pretty="tformat:%s" --invert-grep -i --grep=th --grep=Sec >actual &&
 207        test_cmp expect actual
 208'
 209
 210test_expect_success 'log --grep option parsing' '
 211        echo second >expect &&
 212        git log -1 --pretty="tformat:%s" --grep sec >actual &&
 213        test_cmp expect actual &&
 214        test_must_fail git log -1 --pretty="tformat:%s" --grep
 215'
 216
 217test_expect_success 'log -i --grep' '
 218        echo Second >expect &&
 219        git log -1 --pretty="tformat:%s" -i --grep=sec >actual &&
 220        test_cmp expect actual
 221'
 222
 223test_expect_success 'log --grep -i' '
 224        echo Second >expect &&
 225        git log -1 --pretty="tformat:%s" --grep=sec -i >actual &&
 226        test_cmp expect actual
 227'
 228
 229test_expect_success 'log -F -E --grep=<ere> uses ere' '
 230        echo second >expect &&
 231        git log -1 --pretty="tformat:%s" -F -E --grep=s.c.nd >actual &&
 232        test_cmp expect actual
 233'
 234
 235cat > expect <<EOF
 236* Second
 237* sixth
 238* fifth
 239* fourth
 240* third
 241* second
 242* initial
 243EOF
 244
 245test_expect_success 'simple log --graph' '
 246        git log --graph --pretty=tformat:%s >actual &&
 247        test_cmp expect actual
 248'
 249
 250test_expect_success 'set up merge history' '
 251        git checkout -b side HEAD~4 &&
 252        test_commit side-1 1 1 &&
 253        test_commit side-2 2 2 &&
 254        git checkout master &&
 255        git merge side
 256'
 257
 258cat > expect <<\EOF
 259*   Merge branch 'side'
 260|\
 261| * side-2
 262| * side-1
 263* | Second
 264* | sixth
 265* | fifth
 266* | fourth
 267|/
 268* third
 269* second
 270* initial
 271EOF
 272
 273test_expect_success 'log --graph with merge' '
 274        git log --graph --date-order --pretty=tformat:%s |
 275                sed "s/ *\$//" >actual &&
 276        test_cmp expect actual
 277'
 278
 279test_expect_success 'log --raw --graph -m with merge' '
 280        git log --raw --graph --oneline -m master | head -n 500 >actual &&
 281        grep "initial" actual
 282'
 283
 284test_expect_success 'diff-tree --graph' '
 285        git diff-tree --graph master^ | head -n 500 >actual &&
 286        grep "one" actual
 287'
 288
 289cat > expect <<\EOF
 290*   commit master
 291|\  Merge: A B
 292| | Author: A U Thor <author@example.com>
 293| |
 294| |     Merge branch 'side'
 295| |
 296| * commit side
 297| | Author: A U Thor <author@example.com>
 298| |
 299| |     side-2
 300| |
 301| * commit tags/side-1
 302| | Author: A U Thor <author@example.com>
 303| |
 304| |     side-1
 305| |
 306* | commit master~1
 307| | Author: A U Thor <author@example.com>
 308| |
 309| |     Second
 310| |
 311* | commit master~2
 312| | Author: A U Thor <author@example.com>
 313| |
 314| |     sixth
 315| |
 316* | commit master~3
 317| | Author: A U Thor <author@example.com>
 318| |
 319| |     fifth
 320| |
 321* | commit master~4
 322|/  Author: A U Thor <author@example.com>
 323|
 324|       fourth
 325|
 326* commit tags/side-1~1
 327| Author: A U Thor <author@example.com>
 328|
 329|     third
 330|
 331* commit tags/side-1~2
 332| Author: A U Thor <author@example.com>
 333|
 334|     second
 335|
 336* commit tags/side-1~3
 337  Author: A U Thor <author@example.com>
 338
 339      initial
 340EOF
 341
 342test_expect_success 'log --graph with full output' '
 343        git log --graph --date-order --pretty=short |
 344                git name-rev --name-only --stdin |
 345                sed "s/Merge:.*/Merge: A B/;s/ *\$//" >actual &&
 346        test_cmp expect actual
 347'
 348
 349test_expect_success 'set up more tangled history' '
 350        git checkout -b tangle HEAD~6 &&
 351        test_commit tangle-a tangle-a a &&
 352        git merge master~3 &&
 353        git merge side~1 &&
 354        git checkout master &&
 355        git merge tangle &&
 356        git checkout -b reach &&
 357        test_commit reach &&
 358        git checkout master &&
 359        git checkout -b octopus-a &&
 360        test_commit octopus-a &&
 361        git checkout master &&
 362        git checkout -b octopus-b &&
 363        test_commit octopus-b &&
 364        git checkout master &&
 365        test_commit seventh &&
 366        git merge octopus-a octopus-b &&
 367        git merge reach
 368'
 369
 370cat > expect <<\EOF
 371*   Merge tag 'reach'
 372|\
 373| \
 374|  \
 375*-. \   Merge tags 'octopus-a' and 'octopus-b'
 376|\ \ \
 377* | | | seventh
 378| | * | octopus-b
 379| |/ /
 380|/| |
 381| * | octopus-a
 382|/ /
 383| * reach
 384|/
 385*   Merge branch 'tangle'
 386|\
 387| *   Merge branch 'side' (early part) into tangle
 388| |\
 389| * \   Merge branch 'master' (early part) into tangle
 390| |\ \
 391| * | | tangle-a
 392* | | |   Merge branch 'side'
 393|\ \ \ \
 394| * | | | side-2
 395| | |_|/
 396| |/| |
 397| * | | side-1
 398* | | | Second
 399* | | | sixth
 400| |_|/
 401|/| |
 402* | | fifth
 403* | | fourth
 404|/ /
 405* | third
 406|/
 407* second
 408* initial
 409EOF
 410
 411test_expect_success 'log --graph with merge' '
 412        git log --graph --date-order --pretty=tformat:%s |
 413                sed "s/ *\$//" >actual &&
 414        test_cmp expect actual
 415'
 416
 417test_expect_success 'log.decorate configuration' '
 418        git log --oneline >expect.none &&
 419        git log --oneline --decorate >expect.short &&
 420        git log --oneline --decorate=full >expect.full &&
 421
 422        echo "[log] decorate" >>.git/config &&
 423        git log --oneline >actual &&
 424        test_cmp expect.short actual &&
 425
 426        test_config log.decorate true &&
 427        git log --oneline >actual &&
 428        test_cmp expect.short actual &&
 429        git log --oneline --decorate=full >actual &&
 430        test_cmp expect.full actual &&
 431        git log --oneline --decorate=no >actual &&
 432        test_cmp expect.none actual &&
 433
 434        test_config log.decorate no &&
 435        git log --oneline >actual &&
 436        test_cmp expect.none actual &&
 437        git log --oneline --decorate >actual &&
 438        test_cmp expect.short actual &&
 439        git log --oneline --decorate=full >actual &&
 440        test_cmp expect.full actual &&
 441
 442        test_config log.decorate 1 &&
 443        git log --oneline >actual &&
 444        test_cmp expect.short actual &&
 445        git log --oneline --decorate=full >actual &&
 446        test_cmp expect.full actual &&
 447        git log --oneline --decorate=no >actual &&
 448        test_cmp expect.none actual &&
 449
 450        test_config log.decorate short &&
 451        git log --oneline >actual &&
 452        test_cmp expect.short actual &&
 453        git log --oneline --no-decorate >actual &&
 454        test_cmp expect.none actual &&
 455        git log --oneline --decorate=full >actual &&
 456        test_cmp expect.full actual &&
 457
 458        test_config log.decorate full &&
 459        git log --oneline >actual &&
 460        test_cmp expect.full actual &&
 461        git log --oneline --no-decorate >actual &&
 462        test_cmp expect.none actual &&
 463        git log --oneline --decorate >actual &&
 464        test_cmp expect.short actual &&
 465
 466        test_unconfig log.decorate &&
 467        git log --pretty=raw >expect.raw &&
 468        test_config log.decorate full &&
 469        git log --pretty=raw >actual &&
 470        test_cmp expect.raw actual
 471
 472'
 473
 474test_expect_success 'reflog is expected format' '
 475        git log -g --abbrev-commit --pretty=oneline >expect &&
 476        git reflog >actual &&
 477        test_cmp expect actual
 478'
 479
 480test_expect_success 'whatchanged is expected format' '
 481        git log --no-merges --raw >expect &&
 482        git whatchanged >actual &&
 483        test_cmp expect actual
 484'
 485
 486test_expect_success 'log.abbrevCommit configuration' '
 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        test_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
 529test_expect_success 'git log -c --follow' '
 530        test_create_repo follow-c &&
 531        (
 532                cd follow-c &&
 533                test_commit initial file original &&
 534                git rm file &&
 535                test_commit rename file2 original &&
 536                git reset --hard initial &&
 537                test_commit modify file foo &&
 538                git merge -m merge rename &&
 539                git log -c --follow file2
 540        )
 541'
 542
 543cat >expect <<\EOF
 544*   commit COMMIT_OBJECT_NAME
 545|\  Merge: MERGE_PARENTS
 546| | Author: A U Thor <author@example.com>
 547| |
 548| |     Merge HEADS DESCRIPTION
 549| |
 550| * commit COMMIT_OBJECT_NAME
 551| | Author: A U Thor <author@example.com>
 552| |
 553| |     reach
 554| | ---
 555| |  reach.t | 1 +
 556| |  1 file changed, 1 insertion(+)
 557| |
 558| | diff --git a/reach.t b/reach.t
 559| | new file mode 100644
 560| | index 0000000..10c9591
 561| | --- /dev/null
 562| | +++ b/reach.t
 563| | @@ -0,0 +1 @@
 564| | +reach
 565| |
 566|  \
 567*-. \   commit COMMIT_OBJECT_NAME
 568|\ \ \  Merge: MERGE_PARENTS
 569| | | | Author: A U Thor <author@example.com>
 570| | | |
 571| | | |     Merge HEADS DESCRIPTION
 572| | | |
 573| | * | commit COMMIT_OBJECT_NAME
 574| | |/  Author: A U Thor <author@example.com>
 575| | |
 576| | |       octopus-b
 577| | |   ---
 578| | |    octopus-b.t | 1 +
 579| | |    1 file changed, 1 insertion(+)
 580| | |
 581| | |   diff --git a/octopus-b.t b/octopus-b.t
 582| | |   new file mode 100644
 583| | |   index 0000000..d5fcad0
 584| | |   --- /dev/null
 585| | |   +++ b/octopus-b.t
 586| | |   @@ -0,0 +1 @@
 587| | |   +octopus-b
 588| | |
 589| * | commit COMMIT_OBJECT_NAME
 590| |/  Author: A U Thor <author@example.com>
 591| |
 592| |       octopus-a
 593| |   ---
 594| |    octopus-a.t | 1 +
 595| |    1 file changed, 1 insertion(+)
 596| |
 597| |   diff --git a/octopus-a.t b/octopus-a.t
 598| |   new file mode 100644
 599| |   index 0000000..11ee015
 600| |   --- /dev/null
 601| |   +++ b/octopus-a.t
 602| |   @@ -0,0 +1 @@
 603| |   +octopus-a
 604| |
 605* | commit COMMIT_OBJECT_NAME
 606|/  Author: A U Thor <author@example.com>
 607|
 608|       seventh
 609|   ---
 610|    seventh.t | 1 +
 611|    1 file changed, 1 insertion(+)
 612|
 613|   diff --git a/seventh.t b/seventh.t
 614|   new file mode 100644
 615|   index 0000000..9744ffc
 616|   --- /dev/null
 617|   +++ b/seventh.t
 618|   @@ -0,0 +1 @@
 619|   +seventh
 620|
 621*   commit COMMIT_OBJECT_NAME
 622|\  Merge: MERGE_PARENTS
 623| | Author: A U Thor <author@example.com>
 624| |
 625| |     Merge branch 'tangle'
 626| |
 627| *   commit COMMIT_OBJECT_NAME
 628| |\  Merge: MERGE_PARENTS
 629| | | Author: A U Thor <author@example.com>
 630| | |
 631| | |     Merge branch 'side' (early part) into tangle
 632| | |
 633| * |   commit COMMIT_OBJECT_NAME
 634| |\ \  Merge: MERGE_PARENTS
 635| | | | Author: A U Thor <author@example.com>
 636| | | |
 637| | | |     Merge branch 'master' (early part) into tangle
 638| | | |
 639| * | | commit COMMIT_OBJECT_NAME
 640| | | | Author: A U Thor <author@example.com>
 641| | | |
 642| | | |     tangle-a
 643| | | | ---
 644| | | |  tangle-a | 1 +
 645| | | |  1 file changed, 1 insertion(+)
 646| | | |
 647| | | | diff --git a/tangle-a b/tangle-a
 648| | | | new file mode 100644
 649| | | | index 0000000..7898192
 650| | | | --- /dev/null
 651| | | | +++ b/tangle-a
 652| | | | @@ -0,0 +1 @@
 653| | | | +a
 654| | | |
 655* | | |   commit COMMIT_OBJECT_NAME
 656|\ \ \ \  Merge: MERGE_PARENTS
 657| | | | | Author: A U Thor <author@example.com>
 658| | | | |
 659| | | | |     Merge branch 'side'
 660| | | | |
 661| * | | | commit COMMIT_OBJECT_NAME
 662| | |_|/  Author: A U Thor <author@example.com>
 663| |/| |
 664| | | |       side-2
 665| | | |   ---
 666| | | |    2 | 1 +
 667| | | |    1 file changed, 1 insertion(+)
 668| | | |
 669| | | |   diff --git a/2 b/2
 670| | | |   new file mode 100644
 671| | | |   index 0000000..0cfbf08
 672| | | |   --- /dev/null
 673| | | |   +++ b/2
 674| | | |   @@ -0,0 +1 @@
 675| | | |   +2
 676| | | |
 677| * | | commit COMMIT_OBJECT_NAME
 678| | | | Author: A U Thor <author@example.com>
 679| | | |
 680| | | |     side-1
 681| | | | ---
 682| | | |  1 | 1 +
 683| | | |  1 file changed, 1 insertion(+)
 684| | | |
 685| | | | diff --git a/1 b/1
 686| | | | new file mode 100644
 687| | | | index 0000000..d00491f
 688| | | | --- /dev/null
 689| | | | +++ b/1
 690| | | | @@ -0,0 +1 @@
 691| | | | +1
 692| | | |
 693* | | | commit COMMIT_OBJECT_NAME
 694| | | | Author: A U Thor <author@example.com>
 695| | | |
 696| | | |     Second
 697| | | | ---
 698| | | |  one | 1 +
 699| | | |  1 file changed, 1 insertion(+)
 700| | | |
 701| | | | diff --git a/one b/one
 702| | | | new file mode 100644
 703| | | | index 0000000..9a33383
 704| | | | --- /dev/null
 705| | | | +++ b/one
 706| | | | @@ -0,0 +1 @@
 707| | | | +case
 708| | | |
 709* | | | commit COMMIT_OBJECT_NAME
 710| |_|/  Author: A U Thor <author@example.com>
 711|/| |
 712| | |       sixth
 713| | |   ---
 714| | |    a/two | 1 -
 715| | |    1 file changed, 1 deletion(-)
 716| | |
 717| | |   diff --git a/a/two b/a/two
 718| | |   deleted file mode 100644
 719| | |   index 9245af5..0000000
 720| | |   --- a/a/two
 721| | |   +++ /dev/null
 722| | |   @@ -1 +0,0 @@
 723| | |   -ni
 724| | |
 725* | | commit COMMIT_OBJECT_NAME
 726| | | Author: A U Thor <author@example.com>
 727| | |
 728| | |     fifth
 729| | | ---
 730| | |  a/two | 1 +
 731| | |  1 file changed, 1 insertion(+)
 732| | |
 733| | | diff --git a/a/two b/a/two
 734| | | new file mode 100644
 735| | | index 0000000..9245af5
 736| | | --- /dev/null
 737| | | +++ b/a/two
 738| | | @@ -0,0 +1 @@
 739| | | +ni
 740| | |
 741* | | commit COMMIT_OBJECT_NAME
 742|/ /  Author: A U Thor <author@example.com>
 743| |
 744| |       fourth
 745| |   ---
 746| |    ein | 1 +
 747| |    1 file changed, 1 insertion(+)
 748| |
 749| |   diff --git a/ein b/ein
 750| |   new file mode 100644
 751| |   index 0000000..9d7e69f
 752| |   --- /dev/null
 753| |   +++ b/ein
 754| |   @@ -0,0 +1 @@
 755| |   +ichi
 756| |
 757* | commit COMMIT_OBJECT_NAME
 758|/  Author: A U Thor <author@example.com>
 759|
 760|       third
 761|   ---
 762|    ichi | 1 +
 763|    one  | 1 -
 764|    2 files changed, 1 insertion(+), 1 deletion(-)
 765|
 766|   diff --git a/ichi b/ichi
 767|   new file mode 100644
 768|   index 0000000..9d7e69f
 769|   --- /dev/null
 770|   +++ b/ichi
 771|   @@ -0,0 +1 @@
 772|   +ichi
 773|   diff --git a/one b/one
 774|   deleted file mode 100644
 775|   index 9d7e69f..0000000
 776|   --- a/one
 777|   +++ /dev/null
 778|   @@ -1 +0,0 @@
 779|   -ichi
 780|
 781* commit COMMIT_OBJECT_NAME
 782| Author: A U Thor <author@example.com>
 783|
 784|     second
 785| ---
 786|  one | 2 +-
 787|  1 file changed, 1 insertion(+), 1 deletion(-)
 788|
 789| diff --git a/one b/one
 790| index 5626abf..9d7e69f 100644
 791| --- a/one
 792| +++ b/one
 793| @@ -1 +1 @@
 794| -one
 795| +ichi
 796|
 797* commit COMMIT_OBJECT_NAME
 798  Author: A U Thor <author@example.com>
 799
 800      initial
 801  ---
 802   one | 1 +
 803   1 file changed, 1 insertion(+)
 804
 805  diff --git a/one b/one
 806  new file mode 100644
 807  index 0000000..5626abf
 808  --- /dev/null
 809  +++ b/one
 810  @@ -0,0 +1 @@
 811  +one
 812EOF
 813
 814sanitize_output () {
 815        sed -e 's/ *$//' \
 816            -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
 817            -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
 818            -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \
 819            -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \
 820            -e 's/, 0 deletions(-)//' \
 821            -e 's/, 0 insertions(+)//' \
 822            -e 's/ 1 files changed, / 1 file changed, /' \
 823            -e 's/, 1 deletions(-)/, 1 deletion(-)/' \
 824            -e 's/, 1 insertions(+)/, 1 insertion(+)/'
 825}
 826
 827test_expect_success 'log --graph with diff and stats' '
 828        git log --graph --pretty=short --stat -p >actual &&
 829        sanitize_output >actual.sanitized <actual &&
 830        test_i18ncmp expect actual.sanitized
 831'
 832
 833test_expect_success 'dotdot is a parent directory' '
 834        mkdir -p a/b &&
 835        ( echo sixth && echo fifth ) >expect &&
 836        ( cd a/b && git log --format=%s .. ) >actual &&
 837        test_cmp expect actual
 838'
 839
 840test_expect_success GPG 'log --graph --show-signature' '
 841        test_when_finished "git reset --hard && git checkout master" &&
 842        git checkout -b signed master &&
 843        echo foo >foo &&
 844        git add foo &&
 845        git commit -S -m signed_commit &&
 846        git log --graph --show-signature -n1 signed >actual &&
 847        grep "^| gpg: Signature made" actual &&
 848        grep "^| gpg: Good signature" actual
 849'
 850
 851test_expect_success GPG 'log --graph --show-signature for merged tag' '
 852        test_when_finished "git reset --hard && git checkout master" &&
 853        git checkout -b plain master &&
 854        echo aaa >bar &&
 855        git add bar &&
 856        git commit -m bar_commit &&
 857        git checkout -b tagged master &&
 858        echo bbb >baz &&
 859        git add baz &&
 860        git commit -m baz_commit &&
 861        git tag -s -m signed_tag_msg signed_tag &&
 862        git checkout plain &&
 863        git merge --no-ff -m msg signed_tag &&
 864        git log --graph --show-signature -n1 plain >actual &&
 865        grep "^|\\\  merged tag" actual &&
 866        grep "^| | gpg: Signature made" actual &&
 867        grep "^| | gpg: Good signature" actual
 868'
 869
 870test_expect_success 'log --graph --no-walk is forbidden' '
 871        test_must_fail git log --graph --no-walk
 872'
 873
 874test_done