@@ -5,6 +5,7 @@ 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"
8
9
9
10
test_expect_success setup '
10
11
@@ -452,8 +453,7 @@ cat > expect <<EOF
452
453
EOF
453
454
454
455
test_expect_success ' simple log --graph' '
455
- git log --graph --pretty=tformat:%s >actual &&
456
- test_cmp expect actual
456
+ test_cmp_graph_file --pretty=tformat:%s
457
457
'
458
458
459
459
cat > expect << EOF
@@ -467,8 +467,7 @@ cat > expect <<EOF
467
467
EOF
468
468
469
469
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
470
+ test_cmp_graph_file --line-prefix="123 " --pretty=tformat:%s
472
471
'
473
472
474
473
test_expect_success ' set up merge history' '
@@ -495,9 +494,7 @@ cat > expect <<\EOF
495
494
EOF
496
495
497
496
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
497
+ test_cmp_graph_file --date-order --pretty=tformat:%s
501
498
'
502
499
503
500
cat > expect << \EOF
@@ -516,9 +513,7 @@ cat > expect <<\EOF
516
513
EOF
517
514
518
515
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
516
+ test_cmp_graph_file --line-prefix="| | | " --date-order --pretty=tformat:%s
522
517
'
523
518
524
519
cat > expect.colors << \EOF
538
533
539
534
test_expect_success ' log --graph with merge with log.graphColors' '
540
535
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
536
+ test_cmp_colored_graph_file --date-order --pretty=tformat:%s
544
537
'
545
538
546
539
test_expect_success ' log --raw --graph -m with merge' '
@@ -1213,24 +1206,8 @@ cat >expect <<\EOF
1213
1206
+one
1214
1207
EOF
1215
1208
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
1209
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
1210
+ test_cmp_graph_file --no-renames --graph --pretty=short --stat -p
1234
1211
'
1235
1212
1236
1213
cat > expect << \EOF
@@ -1505,9 +1482,7 @@ cat >expect <<\EOF
1505
1482
EOF
1506
1483
1507
1484
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
1485
+ test_cmp_graph_file --line-prefix="*** " --no-renames --graph --pretty=short --stat -p
1511
1486
'
1512
1487
1513
1488
cat > expect << -\EOF
@@ -1529,9 +1504,7 @@ cat >expect <<-\EOF
1529
1504
EOF
1530
1505
1531
1506
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
1507
+ test_cmp_graph_file --pretty=tformat:%s --name-status tangle..reach
1535
1508
'
1536
1509
1537
1510
cat > expect << -\EOF
@@ -1553,9 +1526,7 @@ cat >expect <<-\EOF
1553
1526
EOF
1554
1527
1555
1528
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
1529
+ test_cmp_graph_file --pretty=tformat:%s --name-only tangle..reach
1559
1530
'
1560
1531
1561
1532
test_expect_success ' dotdot is a parent directory' '
0 commit comments