diff mbox series

t9363: Cleanup old version of code

Message ID 20201031151434.36400-1-izabela.bakollari@gmail.com (mailing list archive)
State New, archived
Headers show
Series t9363: Cleanup old version of code | expand

Commit Message

izabela.bakollari@gmail.com Oct. 31, 2020, 3:14 p.m. UTC
From: Izabela Bakollari <izabela.bakollari@gmail.com>

Change style for `cd` in subshell.

Signed-off-by: Izabela Bakollari <izabela.bakollari@gmail.com>
---
 contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Junio C Hamano Oct. 31, 2020, 4:56 p.m. UTC | #1
izabela.bakollari@gmail.com writes:

> From: Izabela Bakollari <izabela.bakollari@gmail.com>

> Subject: [PATCH] t9363: Cleanup old version of code

Micronit.  As you can see from "git shortlog --no-merges --since=9.weeks",
the convention here is not capitalize the word after "<area>:", i.e.

    Subject: [PATCH] t9363: clean up old version of code

> Change style for `cd` in subshell.
>
> Signed-off-by: Izabela Bakollari <izabela.bakollari@gmail.com>
> ---
>  contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh b/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh
> index 6187ec67fa..f09a7ed034 100755
> --- a/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh
> +++ b/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh
> @@ -53,8 +53,12 @@ test_expect_failure 'git clone works on previously created wiki with media files
>  	git clone -c remote.origin.mediaimport=true \
>  		mediawiki::'"$WIKI_URL"' mw_dir_clone &&
>  	test_cmp mw_dir_clone/Foo.txt mw_dir/Foo.txt &&
> -	(cd mw_dir_clone && git checkout HEAD^) &&
> -	(cd mw_dir && git checkout HEAD^) &&
> +	(
> +		cd mw_dir_clone && git checkout HEAD^
> +	) &&
> +	(
> +		cd mw_dir && git checkout HEAD^
> +	) &&

This is not wrong per-se, but I do not think it is too ambitious a
clean-up to declare

	(cd there && git any-single-git-command-with-args)

is an obsolete style and recommend it to be rewritten to

	git -C there any-single-git-command-with-args

In other words, I think

>  	test_cmp mw_dir_clone/Foo.txt mw_dir/Foo.txt &&
> -	(cd mw_dir_clone && git checkout HEAD^) &&
> -	(cd mw_dir && git checkout HEAD^) &&
> +	git -C mw_dir_clone checkout HEAD^ &&
> +	git -C mw_dir checkout HEAD^ &&

would be more preferrable.

>  	test_path_is_file mw_dir_clone/Foo.txt &&
>  	test_cmp mw_dir_clone/Foo.txt mw_dir/Foo.txt
>  '

Thanks.
diff mbox series

Patch

diff --git a/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh b/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh
index 6187ec67fa..f09a7ed034 100755
--- a/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh
+++ b/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh
@@ -53,8 +53,12 @@  test_expect_failure 'git clone works on previously created wiki with media files
 	git clone -c remote.origin.mediaimport=true \
 		mediawiki::'"$WIKI_URL"' mw_dir_clone &&
 	test_cmp mw_dir_clone/Foo.txt mw_dir/Foo.txt &&
-	(cd mw_dir_clone && git checkout HEAD^) &&
-	(cd mw_dir && git checkout HEAD^) &&
+	(
+		cd mw_dir_clone && git checkout HEAD^
+	) &&
+	(
+		cd mw_dir && git checkout HEAD^
+	) &&
 	test_path_is_file mw_dir_clone/Foo.txt &&
 	test_cmp mw_dir_clone/Foo.txt mw_dir/Foo.txt
 '