t6036, t6042: use test_line_count instead of wc -l

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Elijah Newren 2018-05-24 00:04:36 -07:00 committed by Junio C Hamano
parent 2a4c19efbf
commit 0cdabc1083
2 changed files with 134 additions and 67 deletions

View File

@ -65,9 +65,12 @@ test_expect_success 'merge simple rename+criss-cross with no modifications' '
test_must_fail git merge -s recursive R2^0 &&
test 2 = $(git ls-files -s | wc -l) &&
test 2 = $(git ls-files -u | wc -l) &&
test 2 = $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 2 out &&
git ls-files -u >out &&
test_line_count = 2 out &&
git ls-files -o >out &&
test_line_count = 3 out &&
test $(git rev-parse :2:three) = $(git rev-parse L2:three) &&
test $(git rev-parse :3:three) = $(git rev-parse R2:three) &&
@ -135,9 +138,12 @@ test_expect_success 'merge criss-cross + rename merges with basic modification'
test_must_fail git merge -s recursive R2^0 &&
test 2 = $(git ls-files -s | wc -l) &&
test 2 = $(git ls-files -u | wc -l) &&
test 2 = $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 2 out &&
git ls-files -u >out &&
test_line_count = 2 out &&
git ls-files -o >out &&
test_line_count = 3 out &&
test $(git rev-parse :2:three) = $(git rev-parse L2:three) &&
test $(git rev-parse :3:three) = $(git rev-parse R2:three) &&
@ -211,9 +217,12 @@ test_expect_success 'git detects differently handled merges conflict' '
test_must_fail git merge -s recursive E^0 &&
test 3 = $(git ls-files -s | wc -l) &&
test 3 = $(git ls-files -u | wc -l) &&
test 0 = $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 3 out &&
git ls-files -u >out &&
test_line_count = 3 out &&
git ls-files -o >out &&
test_line_count = 1 out &&
test $(git rev-parse :2:new_a) = $(git rev-parse D:new_a) &&
test $(git rev-parse :3:new_a) = $(git rev-parse E:new_a) &&
@ -297,8 +306,10 @@ test_expect_success 'git detects conflict merging criss-cross+modify/delete' '
test_must_fail git merge -s recursive E^0 &&
test 2 -eq $(git ls-files -s | wc -l) &&
test 2 -eq $(git ls-files -u | wc -l) &&
git ls-files -s >out &&
test_line_count = 2 out &&
git ls-files -u >out &&
test_line_count = 2 out &&
test $(git rev-parse :1:file) = $(git rev-parse master:file) &&
test $(git rev-parse :2:file) = $(git rev-parse B:file)
@ -314,8 +325,10 @@ test_expect_success 'git detects conflict merging criss-cross+modify/delete, rev
test_must_fail git merge -s recursive D^0 &&
test 2 -eq $(git ls-files -s | wc -l) &&
test 2 -eq $(git ls-files -u | wc -l) &&
git ls-files -s >out &&
test_line_count = 2 out &&
git ls-files -u >out &&
test_line_count = 2 out &&
test $(git rev-parse :1:file) = $(git rev-parse master:file) &&
test $(git rev-parse :3:file) = $(git rev-parse B:file)
@ -423,9 +436,12 @@ test_expect_success 'merge of D & E1 fails but has appropriate contents' '
test_must_fail git merge -s recursive E1^0 &&
test 2 -eq $(git ls-files -s | wc -l) &&
test 1 -eq $(git ls-files -u | wc -l) &&
test 0 -eq $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 2 out &&
git ls-files -u >out &&
test_line_count = 1 out &&
git ls-files -o >out &&
test_line_count = 1 out &&
test $(git rev-parse :0:ignore-me) = $(git rev-parse A:ignore-me) &&
test $(git rev-parse :2:a) = $(git rev-parse B:a)
@ -440,9 +456,12 @@ test_expect_success 'merge of E1 & D fails but has appropriate contents' '
test_must_fail git merge -s recursive D^0 &&
test 2 -eq $(git ls-files -s | wc -l) &&
test 1 -eq $(git ls-files -u | wc -l) &&
test 0 -eq $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 2 out &&
git ls-files -u >out &&
test_line_count = 1 out &&
git ls-files -o >out &&
test_line_count = 1 out &&
test $(git rev-parse :0:ignore-me) = $(git rev-parse A:ignore-me) &&
test $(git rev-parse :3:a) = $(git rev-parse B:a)
@ -457,9 +476,12 @@ test_expect_success 'merge of D & E2 fails but has appropriate contents' '
test_must_fail git merge -s recursive E2^0 &&
test 4 -eq $(git ls-files -s | wc -l) &&
test 3 -eq $(git ls-files -u | wc -l) &&
test 1 -eq $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 4 out &&
git ls-files -u >out &&
test_line_count = 3 out &&
git ls-files -o >out &&
test_line_count = 2 out &&
test $(git rev-parse :2:a) = $(git rev-parse B:a) &&
test $(git rev-parse :3:a/file) = $(git rev-parse E2:a/file) &&
@ -478,9 +500,12 @@ test_expect_success 'merge of E2 & D fails but has appropriate contents' '
test_must_fail git merge -s recursive D^0 &&
test 4 -eq $(git ls-files -s | wc -l) &&
test 3 -eq $(git ls-files -u | wc -l) &&
test 1 -eq $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 4 out &&
git ls-files -u >out &&
test_line_count = 3 out &&
git ls-files -o >out &&
test_line_count = 2 out &&
test $(git rev-parse :3:a) = $(git rev-parse B:a) &&
test $(git rev-parse :2:a/file) = $(git rev-parse E2:a/file) &&
@ -574,9 +599,12 @@ test_expect_success 'handle rename/rename(1to2)/modify followed by what looks li
git merge -s recursive E^0 &&
test 1 -eq $(git ls-files -s | wc -l) &&
test 0 -eq $(git ls-files -u | wc -l) &&
test 0 -eq $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 1 out &&
git ls-files -u >out &&
test_line_count = 0 out &&
git ls-files -o >out &&
test_line_count = 1 out &&
test $(git rev-parse HEAD:newname) = $(git rev-parse E:newname)
)
@ -653,9 +681,12 @@ test_expect_failure 'detect rename/rename/add-source for virtual merge-base' '
git merge -s recursive E^0 &&
test 3 -eq $(git ls-files -s | wc -l) &&
test 0 -eq $(git ls-files -u | wc -l) &&
test 0 -eq $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 3 out &&
git ls-files -u >out &&
test_line_count = 0 out &&
git ls-files -o >out &&
test_line_count = 1 out &&
test $(git rev-parse HEAD:b) = $(git rev-parse A:a) &&
test $(git rev-parse HEAD:c) = $(git rev-parse A:a) &&
@ -727,9 +758,12 @@ test_expect_success 'virtual merge base handles rename/rename(1to2)/add-dest' '
git merge -s recursive E^0 &&
test 2 -eq $(git ls-files -s | wc -l) &&
test 0 -eq $(git ls-files -u | wc -l) &&
test 0 -eq $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 2 out &&
git ls-files -u >out &&
test_line_count = 0 out &&
git ls-files -o >out &&
test_line_count = 1 out &&
test $(git rev-parse HEAD:a) = $(git rev-parse A:a) &&
test $(git rev-parse HEAD:c) = $(git rev-parse E:c)

View File

@ -116,9 +116,12 @@ test_expect_failure 'conflict caused if rename not detected' '
git checkout -q C^0 &&
git merge -s recursive B^0 &&
test 3 -eq $(git ls-files -s | wc -l) &&
test 0 -eq $(git ls-files -u | wc -l) &&
test 0 -eq $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 3 out &&
git ls-files -u >out &&
test_line_count = 0 out &&
git ls-files -o >out &&
test_line_count = 1 out &&
test_line_count = 6 c &&
test $(git rev-parse HEAD:a) = $(git rev-parse B:a) &&
@ -203,9 +206,12 @@ test_expect_failure 'detect rename/add-source and preserve all data' '
git merge -s recursive C^0 &&
test 2 -eq $(git ls-files -s | wc -l) &&
test 2 -eq $(git ls-files -u | wc -l) &&
test 0 -eq $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 2 out &&
git ls-files -u >out &&
test_line_count = 2 out &&
git ls-files -o >out &&
test_line_count = 1 out &&
test -f a &&
test -f b &&
@ -223,9 +229,12 @@ test_expect_failure 'detect rename/add-source and preserve all data, merge other
git merge -s recursive B^0 &&
test 2 -eq $(git ls-files -s | wc -l) &&
test 2 -eq $(git ls-files -u | wc -l) &&
test 0 -eq $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 2 out &&
git ls-files -u >out &&
test_line_count = 2 out &&
git ls-files -o >out &&
test_line_count = 1 out &&
test -f a &&
test -f b &&
@ -279,9 +288,12 @@ test_expect_success 'rename/directory conflict + clean content merge' '
test_must_fail git merge -s recursive right^0 &&
test 2 -eq $(git ls-files -s | wc -l) &&
test 1 -eq $(git ls-files -u | wc -l) &&
test 1 -eq $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 2 out &&
git ls-files -u >out &&
test_line_count = 1 out &&
git ls-files -o >out &&
test_line_count = 2 out &&
echo 0 >expect &&
git cat-file -p base:file >>expect &&
@ -307,9 +319,12 @@ test_expect_success 'rename/directory conflict + content merge conflict' '
test_must_fail git merge -s recursive right^0 &&
test 4 -eq $(git ls-files -s | wc -l) &&
test 3 -eq $(git ls-files -u | wc -l) &&
test 1 -eq $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 4 out &&
git ls-files -u >out &&
test_line_count = 3 out &&
git ls-files -o >out &&
test_line_count = 2 out &&
git cat-file -p left-conflict:newfile >left &&
git cat-file -p base:file >base &&
@ -367,9 +382,12 @@ test_expect_success 'disappearing dir in rename/directory conflict handled' '
git merge -s recursive right^0 &&
test 1 -eq $(git ls-files -s | wc -l) &&
test 0 -eq $(git ls-files -u | wc -l) &&
test 0 -eq $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 1 out &&
git ls-files -u >out &&
test_line_count = 0 out &&
git ls-files -o >out &&
test_line_count = 1 out &&
echo 0 >expect &&
git cat-file -p base:sub/file >>expect &&
@ -426,10 +444,14 @@ test_expect_success 'handle rename/rename (2to1) conflict correctly' '
test_must_fail git merge -s recursive C^0 >out &&
test_i18ngrep "CONFLICT (rename/rename)" out &&
test 2 -eq $(git ls-files -s | wc -l) &&
test 2 -eq $(git ls-files -u | wc -l) &&
test 2 -eq $(git ls-files -u c | wc -l) &&
test 3 -eq $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 2 out &&
git ls-files -u >out &&
test_line_count = 2 out &&
git ls-files -u c >out &&
test_line_count = 2 out &&
git ls-files -o >out &&
test_line_count = 3 out &&
test ! -f a &&
test ! -f b &&
@ -476,9 +498,12 @@ test_expect_success 'merge has correct working tree contents' '
test_must_fail git merge -s recursive B^0 &&
test 3 -eq $(git ls-files -s | wc -l) &&
test 3 -eq $(git ls-files -u | wc -l) &&
test 0 -eq $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 3 out &&
git ls-files -u >out &&
test_line_count = 3 out &&
git ls-files -o >out &&
test_line_count = 1 out &&
test $(git rev-parse :1:a) = $(git rev-parse A:a) &&
test $(git rev-parse :3:b) = $(git rev-parse A:a) &&
@ -527,8 +552,10 @@ test_expect_failure 'detect conflict with rename/rename(1to2)/add-source merge'
test_must_fail git merge -s recursive C^0 &&
test 4 -eq $(git ls-files -s | wc -l) &&
test 0 -eq $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 4 out &&
git ls-files -o >out &&
test_line_count = 1 out &&
test $(git rev-parse 3:a) = $(git rev-parse C:a) &&
test $(git rev-parse 1:a) = $(git rev-parse A:a) &&
@ -573,8 +600,10 @@ test_expect_failure 'rename/rename/add-source still tracks new a file' '
git checkout C^0 &&
git merge -s recursive B^0 &&
test 2 -eq $(git ls-files -s | wc -l) &&
test 0 -eq $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 2 out &&
git ls-files -o >out &&
test_line_count = 1 out &&
test $(git rev-parse HEAD:a) = $(git rev-parse C:a) &&
test $(git rev-parse HEAD:b) = $(git rev-parse A:a)
@ -615,10 +644,14 @@ test_expect_success 'rename/rename/add-dest merge still knows about conflicting
git checkout C^0 &&
test_must_fail git merge -s recursive B^0 &&
test 5 -eq $(git ls-files -s | wc -l) &&
test 2 -eq $(git ls-files -u b | wc -l) &&
test 2 -eq $(git ls-files -u c | wc -l) &&
test 4 -eq $(git ls-files -o | wc -l) &&
git ls-files -s >out &&
test_line_count = 5 out &&
git ls-files -u b >out &&
test_line_count = 2 out &&
git ls-files -u c >out &&
test_line_count = 2 out &&
git ls-files -o >out &&
test_line_count = 5 out &&
test $(git rev-parse :1:a) = $(git rev-parse A:a) &&
test $(git rev-parse :2:b) = $(git rev-parse C:b) &&