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