diff mbox series

[07/11] t7001: use ': >' rather than 'touch'

Message ID 20200925170256.11490-8-shubhunic@gmail.com
State New
Headers show
Series Modernizing the t7001 test script | expand

Commit Message

Shubham Verma Sept. 25, 2020, 5:02 p.m. UTC
From: Shubham Verma <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(-)

Comments

Eric Sunshine Sept. 25, 2020, 6:57 p.m. UTC | #1
On Fri, Sep 25, 2020 at 1:03 PM shubham verma <shubhunic@gmail.com> wrote:
> t7001: use ': >' rather than 'touch'
>
> Use `>` rather than `touch` to create an empty file when the
> timestamp isn't relevant to the test.

There is an inconsistency here. In the subject you say ": >" but in
the body just ">".

A couple more comments below...

> Signed-off-by: shubham verma <shubhunic@gmail.com>
> ---
> diff --git 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 &&

In patch [5/11] you dropped whitespace following the redirection
operator, however, this patch introduces several new cases of unwanted
whitespace.

Checking "master", I see that there are 209 instances of `: >` in
tests, but 1023 instances of `>`, which suggests that we should stick
with plain `>` rather than `: >` in this patch.
Junio C Hamano Sept. 25, 2020, 8:21 p.m. UTC | #2
Eric Sunshine <sunshine@sunshineco.com> writes:

> In patch [5/11] you dropped whitespace following the redirection
> operator, however, this patch introduces several new cases of unwanted
> whitespace.
>
> Checking "master", I see that there are 209 instances of `: >` in
> tests, but 1023 instances of `>`, which suggests that we should stick
> with plain `>` rather than `: >` in this patch.

Agreed on both points.  Thanks for a careful review.
diff mbox series

Patch

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 3a3ace6d73..728a937eeb 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 &&
@@ -482,7 +482,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"
@@ -490,7 +490,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" &&