git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[GSoC][PATCH 1/1] t1050: clean up checks for file existence

From
RJRasmus Jonsson <wasmus@zom.bi>
Date
Feb 22, 2020, 07:13 UTC
Message-ID
<20200222071335.27292-2-wasmus@zom.bi>
In-Reply-To
<20200222071335.27292-1-wasmus@zom.bi>

Replace "test -f" with test_path_is_file, which gives more verbose and accurate output.

Signed-off-by: Rasmus Jonsson <wasmus@zom.bi>
---
 t/t1050-large.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/t/t1050-large.sh b/t/t1050-large.sh
index d3b2adb28b..667fc2a745 100755
--- a/t/t1050-large.sh
+++ b/t/t1050-large.sh
@@ -53,7 +53,8 @@ test_expect_success 'add a large file or two' '
 	for p in .git/objects/pack/pack-*.pack
 	do
 		count=$(( $count + 1 ))
-		if test -f "$p" && idx=${p%.pack}.idx && test -f "$idx"
+		if test_path_is_file "$p" && idx=${p%.pack}.idx &&
+		   test_path_is_file "$idx"
 		then
 			continue
 		fi
@@ -65,7 +66,7 @@ test_expect_success 'add a large file or two' '
 	test $cnt = 2 &&
 	for l in .git/objects/??/??????????????????????????????????????
 	do
-		test -f "$l" || continue
+		test_path_is_file "$l" || continue
 		bad=t
 	done &&
 	test -z "$bad" &&
@@ -76,7 +77,8 @@ test_expect_success 'add a large file or two' '
 	for p in .git/objects/pack/pack-*.pack
 	do
 		count=$(( $count + 1 ))
-		if test -f "$p" && idx=${p%.pack}.idx && test -f "$idx"
+		if test_path_is_file "$p" && idx=${p%.pack}.idx &&
+		   test_path_is_file "$idx"
 		then
 			continue
 		fi
@@ -111,7 +113,7 @@ test_expect_success 'packsize limit' '
 		count=0 &&
 		for pi in .git/objects/pack/pack-*.idx
 		do
-			test -f "$pi" && count=$(( $count + 1 ))
+			test_path_is_file "$pi" && count=$(( $count + 1 ))
 		done &&
 		test $count = 2 &&
 
-- 
2.20.1
Previous: Rasmus JonssonNext: Junio C Hamano
Message 2 of 7 in “Introduction & microproject”
  1. Rasmus JonssonFeb 22, 2020
  2. [GSoC][PATCH 1/1] t1050: clean up checks for file existenceRasmus Jonsson, Feb 22, 2020
  3. Junio C HamanoFeb 22, 2020
  4. brian m. carlsonFeb 22, 2020
  5. Junio C HamanoFeb 22, 2020
  6. Jeff KingFeb 24, 2020
  7. [GSoC][PATCH v2] t1050: replace test -f with test_path_is_fileRasmus Jonsson, Feb 23, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.