@@ -5,6 +5,11 @@ test_description='git log'
5
5
. ./test-lib.sh
6
6
. " $TEST_DIRECTORY /lib-gpg.sh"
7
7
. " $TEST_DIRECTORY /lib-terminal.sh"
8
+ . " $TEST_DIRECTORY /lib-log-graph.sh"
9
+
10
+ test_cmp_graph () {
11
+ lib_test_cmp_graph --format=%s " $@ "
12
+ }
8
13
9
14
test_expect_success setup '
10
15
@@ -452,8 +457,7 @@ cat > expect <<EOF
452
457
EOF
453
458
454
459
test_expect_success ' simple log --graph' '
455
- git log --graph --pretty=tformat:%s >actual &&
456
- test_cmp expect actual
460
+ test_cmp_graph
457
461
'
458
462
459
463
cat > expect << EOF
@@ -467,8 +471,7 @@ cat > expect <<EOF
467
471
EOF
468
472
469
473
test_expect_success ' simple log --graph --line-prefix="123 "' '
470
- git log --graph --line-prefix="123 " --pretty=tformat:%s >actual &&
471
- test_cmp expect actual
474
+ test_cmp_graph --line-prefix="123 "
472
475
'
473
476
474
477
test_expect_success ' set up merge history' '
@@ -495,9 +498,7 @@ cat > expect <<\EOF
495
498
EOF
496
499
497
500
test_expect_success ' log --graph with merge' '
498
- git log --graph --date-order --pretty=tformat:%s |
499
- sed "s/ *\$//" >actual &&
500
- test_cmp expect actual
501
+ test_cmp_graph --date-order
501
502
'
502
503
503
504
cat > expect << \EOF
@@ -516,9 +517,7 @@ cat > expect <<\EOF
516
517
EOF
517
518
518
519
test_expect_success ' log --graph --line-prefix="| | | " with merge' '
519
- git log --line-prefix="| | | " --graph --date-order --pretty=tformat:%s |
520
- sed "s/ *\$//" >actual &&
521
- test_cmp expect actual
520
+ test_cmp_graph --line-prefix="| | | " --date-order
522
521
'
523
522
524
523
cat > expect.colors << \EOF
538
537
539
538
test_expect_success ' log --graph with merge with log.graphColors' '
540
539
test_config log.graphColors " blue,invalid-color, cyan, red , " &&
541
- git log --color=always --graph --date-order --pretty=tformat:%s |
542
- test_decode_color | sed "s/ *\$//" >actual &&
543
- test_cmp expect.colors actual
540
+ lib_test_cmp_colored_graph --date-order --format=%s
544
541
'
545
542
546
543
test_expect_success ' log --raw --graph -m with merge' '
@@ -676,9 +673,7 @@ cat > expect <<\EOF
676
673
EOF
677
674
678
675
test_expect_success ' log --graph with merge' '
679
- git log --graph --date-order --pretty=tformat:%s |
680
- sed "s/ *\$//" >actual &&
681
- test_cmp expect actual
676
+ test_cmp_graph --date-order
682
677
'
683
678
684
679
test_expect_success ' log.decorate configuration' '
@@ -1213,24 +1208,8 @@ cat >expect <<\EOF
1213
1208
+one
1214
1209
EOF
1215
1210
1216
- sanitize_output () {
1217
- sed -e ' s/ *$//' \
1218
- -e ' s/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
1219
- -e ' s/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
1220
- -e ' s/Merge tag.*/Merge HEADS DESCRIPTION/' \
1221
- -e ' s/Merge commit.*/Merge HEADS DESCRIPTION/' \
1222
- -e ' s/, 0 deletions(-)//' \
1223
- -e ' s/, 0 insertions(+)//' \
1224
- -e ' s/ 1 files changed, / 1 file changed, /' \
1225
- -e ' s/, 1 deletions(-)/, 1 deletion(-)/' \
1226
- -e ' s/, 1 insertions(+)/, 1 insertion(+)/' \
1227
- -e ' s/index [0-9a-f]*\.\.[0-9a-f]*/index BEFORE..AFTER/'
1228
- }
1229
-
1230
1211
test_expect_success ' log --graph with diff and stats' '
1231
- git log --no-renames --graph --pretty=short --stat -p >actual &&
1232
- sanitize_output >actual.sanitized <actual &&
1233
- test_i18ncmp expect actual.sanitized
1212
+ lib_test_cmp_short_graph --no-renames --stat -p
1234
1213
'
1235
1214
1236
1215
cat > expect << \EOF
@@ -1505,9 +1484,7 @@ cat >expect <<\EOF
1505
1484
EOF
1506
1485
1507
1486
test_expect_success ' log --line-prefix="*** " --graph with diff and stats' '
1508
- git log --line-prefix="*** " --no-renames --graph --pretty=short --stat -p >actual &&
1509
- sanitize_output >actual.sanitized <actual &&
1510
- test_i18ncmp expect actual.sanitized
1487
+ lib_test_cmp_short_graph --line-prefix="*** " --no-renames --stat -p
1511
1488
'
1512
1489
1513
1490
cat > expect << -\EOF
@@ -1529,9 +1506,7 @@ cat >expect <<-\EOF
1529
1506
EOF
1530
1507
1531
1508
test_expect_success ' log --graph with --name-status' '
1532
- git log --graph --format=%s --name-status tangle..reach >actual &&
1533
- sanitize_output <actual >actual.sanitized &&
1534
- test_cmp expect actual.sanitized
1509
+ test_cmp_graph --name-status tangle..reach
1535
1510
'
1536
1511
1537
1512
cat > expect << -\EOF
@@ -1553,9 +1528,7 @@ cat >expect <<-\EOF
1553
1528
EOF
1554
1529
1555
1530
test_expect_success ' log --graph with --name-only' '
1556
- git log --graph --format=%s --name-only tangle..reach >actual &&
1557
- sanitize_output <actual >actual.sanitized &&
1558
- test_cmp expect actual.sanitized
1531
+ test_cmp_graph --name-only tangle..reach
1559
1532
'
1560
1533
1561
1534
test_expect_success ' dotdot is a parent directory' '
0 commit comments