[PATCH 1/2] t6400: check exit status of ls-files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We will lose the exit status of "git ls-files" if it's being run in
anywhere-but-not-final part of a pipe.

Let's send the output of "git ls-files" to a file first,
and adjust the expected result for "git ls-files -o" since a new
untracked file will be created as a side effect.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@xxxxxxxxx>
---
 t/t6400-merge-df.sh | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/t/t6400-merge-df.sh b/t/t6400-merge-df.sh
index 38700d29b5..fd99a78360 100755
--- a/t/t6400-merge-df.sh
+++ b/t/t6400-merge-df.sh
@@ -82,13 +82,16 @@ test_expect_success 'modify/delete + directory/file conflict' '
 	git checkout delete^0 &&
 	test_must_fail git merge modify &&
 
-	test 5 -eq $(git ls-files -s | wc -l) &&
-	test 4 -eq $(git ls-files -u | wc -l) &&
+	git ls-files -s >out &&
+	test_line_count = 5 out &&
+	git ls-files -u >out &&
+	test_line_count = 4 out &&
+	git ls-files -o >out &&
 	if test "$GIT_TEST_MERGE_ALGORITHM" = ort
 	then
-		test 0 -eq $(git ls-files -o | wc -l)
+		test_line_count = 1 out
 	else
-		test 1 -eq $(git ls-files -o | wc -l)
+		test_line_count = 2 out
 	fi &&
 
 	test_path_is_file letters/file &&
@@ -103,13 +106,16 @@ test_expect_success 'modify/delete + directory/file conflict; other way' '
 
 	test_must_fail git merge delete &&
 
-	test 5 -eq $(git ls-files -s | wc -l) &&
-	test 4 -eq $(git ls-files -u | wc -l) &&
+	git ls-files -s >out &&
+	test_line_count = 5 out &&
+	git ls-files -u >out &&
+	test_line_count = 4 out &&
+	git ls-files -o >out &&
 	if test "$GIT_TEST_MERGE_ALGORITHM" = ort
 	then
-		test 0 -eq $(git ls-files -o | wc -l)
+		test_line_count = 1 out
 	else
-		test 1 -eq $(git ls-files -o | wc -l)
+		test_line_count = 2 out
 	fi &&
 
 	test_path_is_file letters/file &&
-- 
2.31.1.192.g0881477623




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux