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

[PATCH v2 07/10] t7001: use '>' rather than 'touch'

From
shubham verma <shubhunic@gmail.com>
Date
Feb 9, 2021, 17:32 UTC
Message-ID
<20210209173254.17712-8-shubhunic@gmail.com>
In-Reply-To
<20210209173254.17712-1-shubhunic@gmail.com>

Use `>` rather than `touch` to create an empty file when the timestamp isn't relevant to the test.

Signed-off-by: shubham verma <shubhunic@gmail.com>
---
 t/t7001-mv.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 81897a3095..1671241fc8 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -47,14 +47,14 @@ test_expect_success 'checking -k on non-existing file' '
 '
 
 test_expect_success 'checking -k on untracked file' '
-	touch untracked1 &&
+	>untracked1 &&
 	git mv -k untracked1 path0 &&
 	test -f untracked1 &&
 	test ! -f path0/untracked1
 '
 
 test_expect_success 'checking -k on multiple untracked files' '
-	touch untracked2 &&
+	>untracked2 &&
 	git mv -k untracked1 untracked2 path0 &&
 	test -f untracked1 &&
 	test -f untracked2 &&
@@ -63,7 +63,7 @@ test_expect_success 'checking -k on multiple untracked files' '
 '
 
 test_expect_success 'checking -f on untracked file with existing target' '
-	touch path0/untracked1 &&
+	>path0/untracked1 &&
 	test_must_fail git mv -f untracked1 path0 &&
 	test ! -f .git/index.lock &&
 	test -f untracked1 &&
@@ -486,7 +486,7 @@ test_expect_success 'moving nested submodules' '
 	mkdir sub_nested_nested &&
 	(
 		cd sub_nested_nested &&
-		touch nested_level2 &&
+		>nested_level2 &&
 		git init &&
 		git add . &&
 		git commit -m "nested level 2"
@@ -494,7 +494,7 @@ test_expect_success 'moving nested submodules' '
 	mkdir sub_nested &&
 	(
 		cd sub_nested &&
-		touch nested_level1 &&
+		>nested_level1 &&
 		git init &&
 		git add . &&
 		git commit -m "nested level 1" &&
-- 
2.25.1
Previous: shubham vermaNext: shubham verma
Message 7 of 17 in “Modernizing the t7001 test script”
  1. 00/10 Modernizing the t7001 test scriptshubham verma, Feb 9, 2021
  2. 01/10 t7001: modernize test formattingshubham verma, Feb 9, 2021
  3. 02/10 t7001: indent with TABs instead of spacesshubham verma, Feb 9, 2021
  4. 03/10 t7001: remove unnecessary blank linesshubham verma, Feb 9, 2021
  5. 04/10 t7001: modernize subshell formattingshubham verma, Feb 9, 2021
  6. 09/10 t7001: use here-docs instead of echoshubham verma, Feb 9, 2021
  7. 07/10 t7001: use '>' rather than 'touch'shubham verma, Feb 9, 2021
  8. 05/10 t7001: remove whitespace after redirect operatorsshubham verma, Feb 9, 2021
  9. 06/10 t7001: avoid using `cd` outside of subshellsshubham verma, Feb 9, 2021
  10. 08/10 t7001: put each command on a separate lineshubham verma, Feb 9, 2021
  11. 10/10 t7001: use `test` rather than `[`shubham verma, Feb 9, 2021
  12. Eric SunshineFeb 9, 2021
  13. Junio C HamanoFeb 9, 2021
  14. Eric SunshineFeb 11, 2021
  15. Junio C HamanoFeb 11, 2021
  16. Shubham VermaFeb 11, 2021
  17. Eric SunshineFeb 11, 2021

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.