Skip to content

Commit f192a1d

Browse files
abhishekkumar2718gitster
authored andcommitted
t4202: use lib-log-graph functions
Helped-by: Johannes Schindelin <[email protected]> Signed-off-by: Abhishek Kumar <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 05b32dc commit f192a1d

File tree

1 file changed

+10
-39
lines changed

1 file changed

+10
-39
lines changed

t/t4202-log.sh

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ test_description='git log'
55
. ./test-lib.sh
66
. "$TEST_DIRECTORY/lib-gpg.sh"
77
. "$TEST_DIRECTORY/lib-terminal.sh"
8+
. "$TEST_DIRECTORY/lib-log-graph.sh"
89

910
test_expect_success setup '
1011
@@ -452,8 +453,7 @@ cat > expect <<EOF
452453
EOF
453454

454455
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
457457
'
458458

459459
cat > expect <<EOF
@@ -467,8 +467,7 @@ cat > expect <<EOF
467467
EOF
468468

469469
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
472471
'
473472

474473
test_expect_success 'set up merge history' '
@@ -495,9 +494,7 @@ cat > expect <<\EOF
495494
EOF
496495

497496
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
501498
'
502499

503500
cat > expect <<\EOF
@@ -516,9 +513,7 @@ cat > expect <<\EOF
516513
EOF
517514

518515
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
522517
'
523518

524519
cat > expect.colors <<\EOF
@@ -538,9 +533,7 @@ EOF
538533

539534
test_expect_success 'log --graph with merge with log.graphColors' '
540535
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
544537
'
545538

546539
test_expect_success 'log --raw --graph -m with merge' '
@@ -1213,24 +1206,8 @@ cat >expect <<\EOF
12131206
+one
12141207
EOF
12151208

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-
12301209
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
12341211
'
12351212

12361213
cat >expect <<\EOF
@@ -1505,9 +1482,7 @@ cat >expect <<\EOF
15051482
EOF
15061483

15071484
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
15111486
'
15121487

15131488
cat >expect <<-\EOF
@@ -1529,9 +1504,7 @@ cat >expect <<-\EOF
15291504
EOF
15301505

15311506
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
15351508
'
15361509

15371510
cat >expect <<-\EOF
@@ -1553,9 +1526,7 @@ cat >expect <<-\EOF
15531526
EOF
15541527

15551528
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
15591530
'
15601531

15611532
test_expect_success 'dotdot is a parent directory' '

0 commit comments

Comments
 (0)