In this patch series modernize the t7001 test script by changing the
style of its tests from an old one to the modern one and by cleaning
up the test script.
Changes since v1:
- Change commit messages and added brief explanation about commit.
- Modernize subshell formatting
- Use ': >' rather than '>'
Thanks everyone for your feedback and suggestions.
shubham verma (10):
t7001: modernize test formatting
t7001: indent with TABs instead of spaces
t7001: remove unnecessary blank lines
t7001: modernize subshell formatting
t7001: remove whitespace after redirect operators
t7001: avoid using `cd` outside of subshells
t7001: use '>' rather than 'touch'
t7001: put each command on a separate line
t7001: use here-docs instead of echo
t7001: use `test` rather than `[`
t/t7001-mv.sh | 432 ++++++++++++++++++++++++--------------------------
1 file changed, 204 insertions(+), 228 deletions(-)
--
2.25.1
Some tests in this script are formatted using a very old style:
test_expect_success \
'title' \
'body line 1 &&
body line 2'
Update the formatting to the modern style:
test_expect_success 'title' '
body line 1 &&
body line 2
'
Signed-off-by: shubham verma <redacted>
---
t/t7001-mv.sh | 192 +++++++++++++++++++++++++-------------------------
1 file changed, 96 insertions(+), 96 deletions(-)
@@ -3,74 +3,74 @@test_description='git mv in subdirs' ../test-lib.sh-test_expect_success\-'prepare reference tree'\-'mkdirpath0path1&&+test_expect_success'prepare reference tree''+mkdirpath0path1&&cp"$TEST_DIRECTORY"/../COPYINGpath0/COPYING&&gitaddpath0/COPYING&&-gitcommit-madd-a'+gitcommit-madd-a+'-test_expect_success\-'moving the file out of subdirectory'\-'cd path0 && git mv COPYING ../path1/COPYING'+test_expect_success'moving the file out of subdirectory''+cdpath0&&gitmvCOPYING../path1/COPYING+'# in path0 currently-test_expect_success\-'commiting the change'\-'cd .. && git commit -m move-out -a'+test_expect_success'commiting the change''+cd..&&gitcommit-mmove-out-a+'-test_expect_success\-'checking the commit'\-'gitdiff-tree-r-M--name-statusHEAD^HEAD>actual&&-grep"^R100..*path0/COPYING..*path1/COPYING"actual'+test_expect_success'checking the commit''+gitdiff-tree-r-M--name-statusHEAD^HEAD>actual&&+grep"^R100..*path0/COPYING..*path1/COPYING"actual+'-test_expect_success\-'moving the file back into subdirectory'\-'cd path0 && git mv ../path1/COPYING COPYING'+test_expect_success'moving the file back into subdirectory''+cdpath0&&gitmv../path1/COPYINGCOPYING+'# in path0 currently-test_expect_success\-'commiting the change'\-'cd .. && git commit -m move-in -a'--test_expect_success\-'checking the commit'\-'gitdiff-tree-r-M--name-statusHEAD^HEAD>actual&&-grep"^R100..*path1/COPYING..*path0/COPYING"actual'--test_expect_success\-'mv --dry-run does not move file'\-'gitmv-npath0/COPYINGMOVED&&+test_expect_success'commiting the change''+cd..&&gitcommit-mmove-in-a+'++test_expect_success'checking the commit''+gitdiff-tree-r-M--name-statusHEAD^HEAD>actual&&+grep"^R100..*path1/COPYING..*path0/COPYING"actual+'++test_expect_success'mv --dry-run does not move file''+gitmv-npath0/COPYINGMOVED&&test-fpath0/COPYING&&-test!-fMOVED'+test!-fMOVED+'-test_expect_success\-'checking -k on non-existing file'\-'git mv -k idontexist path0'+test_expect_success'checking -k on non-existing file''+gitmv-kidontexistpath0+'-test_expect_success\-'checking -k on untracked file'\-'touchuntracked1&&+test_expect_success'checking -k on untracked file''+touchuntracked1&&gitmv-kuntracked1path0&&test-funtracked1&&-test!-fpath0/untracked1'+test!-fpath0/untracked1+'-test_expect_success\-'checking -k on multiple untracked files'\-'touchuntracked2&&+test_expect_success'checking -k on multiple untracked files''+touchuntracked2&&gitmv-kuntracked1untracked2path0&&test-funtracked1&&test-funtracked2&&test!-fpath0/untracked1&&-test!-fpath0/untracked2'+test!-fpath0/untracked2+'-test_expect_success\-'checking -f on untracked file with existing target'\-'touchpath0/untracked1&&+test_expect_success'checking -f on untracked file with existing target''+touchpath0/untracked1&&test_must_failgitmv-funtracked1path0&&test!-f.git/index.lock&&test-funtracked1&&-test-fpath0/untracked1'+test-fpath0/untracked1+'# clean up the mess in case bad things happen rm-fidontexistuntracked1untracked2\
@@ -78,79 +78,79 @@ rm -f idontexist untracked1 untracked2 \.git/index.lock rmdirpath1-test_expect_success\-'moving to absent target with trailing slash'\-'test_must_failgitmvpath0/COPYINGno-such-dir/&&+test_expect_success'moving to absent target with trailing slash''+test_must_failgitmvpath0/COPYINGno-such-dir/&&test_must_failgitmvpath0/COPYINGno-such-dir//&&gitmvpath0/no-such-dir/&&-test_path_is_dirno-such-dir'+test_path_is_dirno-such-dir+'-test_expect_success\-'clean up'\-'git reset --hard'+test_expect_success'clean up''+gitreset--hard+'-test_expect_success\-'moving to existing untracked target with trailing slash'\-'mkdirpath1&&+test_expect_success'moving to existing untracked target with trailing slash''+mkdirpath1&&gitmvpath0/path1/&&-test_path_is_dirpath1/path0/'+test_path_is_dirpath1/path0/+'-test_expect_success\-'moving to existing tracked target with trailing slash'\-'mkdirpath2&&+test_expect_success'moving to existing tracked target with trailing slash''+mkdirpath2&&>path2/file&&gitaddpath2/file&&gitmvpath1/path0/path2/&&-test_path_is_dirpath2/path0/'+test_path_is_dirpath2/path0/+'-test_expect_success\-'clean up'\-'git reset --hard'+test_expect_success'clean up''+gitreset--hard+'-test_expect_success\-'adding another file'\-'cp"$TEST_DIRECTORY"/../README.mdpath0/README&&+test_expect_success'adding another file''+cp"$TEST_DIRECTORY"/../README.mdpath0/README&&gitaddpath0/README&&-gitcommit-madd2-a'+gitcommit-madd2-a+'-test_expect_success\-'moving whole subdirectory'\-'git mv path0 path2'+test_expect_success'moving whole subdirectory''+gitmvpath0path2+'-test_expect_success\-'commiting the change'\-'git commit -m dir-move -a'+test_expect_success'commiting the change''+gitcommit-mdir-move-a+'-test_expect_success\-'checking the commit'\-'gitdiff-tree-r-M--name-statusHEAD^HEAD>actual&&+test_expect_success'checking the commit''+gitdiff-tree-r-M--name-statusHEAD^HEAD>actual&&grep"^R100..*path0/COPYING..*path2/COPYING"actual&&-grep"^R100..*path0/README..*path2/README"actual'+grep"^R100..*path0/README..*path2/README"actual+'-test_expect_success\-'succeed when source is a prefix of destination'\-'git mv path2/COPYING path2/COPYING-renamed'+test_expect_success'succeed when source is a prefix of destination''+gitmvpath2/COPYINGpath2/COPYING-renamed+'-test_expect_success\-'moving whole subdirectory into subdirectory'\-'git mv path2 path1'+test_expect_success'moving whole subdirectory into subdirectory''+gitmvpath2path1+'-test_expect_success\-'commiting the change'\-'git commit -m dir-move -a'+test_expect_success'commiting the change''+gitcommit-mdir-move-a+'-test_expect_success\-'checking the commit'\-'gitdiff-tree-r-M--name-statusHEAD^HEAD>actual&&+test_expect_success'checking the commit''+gitdiff-tree-r-M--name-statusHEAD^HEAD>actual&&grep"^R100..*path2/COPYING..*path1/path2/COPYING"actual&&-grep"^R100..*path2/README..*path1/path2/README"actual'+grep"^R100..*path2/README..*path1/path2/README"actual+'-test_expect_success\-'do not move directory over existing directory'\-'mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0'+test_expect_success'do not move directory over existing directory''+mkdirpath0&&mkdirpath0/path2&&test_must_failgitmvpath2path0+'-test_expect_success\-'move into "."'\-'git mv path1/path2/ .'+test_expect_success'move into "."''+gitmvpath1/path2/.+' test_expect_success"Michael Cassar's test case"'rm-fr.gitpaperspartA&&
@@ -4,72 +4,72 @@ test_description='git mv in subdirs' ../test-lib.sh test_expect_success'prepare reference tree''-mkdirpath0path1&&-cp"$TEST_DIRECTORY"/../COPYINGpath0/COPYING&&-gitaddpath0/COPYING&&-gitcommit-madd-a+mkdirpath0path1&&+cp"$TEST_DIRECTORY"/../COPYINGpath0/COPYING&&+gitaddpath0/COPYING&&+gitcommit-madd-a' test_expect_success'moving the file out of subdirectory''-cdpath0&&gitmvCOPYING../path1/COPYING+cdpath0&&gitmvCOPYING../path1/COPYING'# in path0 currently test_expect_success'commiting the change''-cd..&&gitcommit-mmove-out-a+cd..&&gitcommit-mmove-out-a' test_expect_success'checking the commit''-gitdiff-tree-r-M--name-statusHEAD^HEAD>actual&&-grep"^R100..*path0/COPYING..*path1/COPYING"actual+gitdiff-tree-r-M--name-statusHEAD^HEAD>actual&&+grep"^R100..*path0/COPYING..*path1/COPYING"actual' test_expect_success'moving the file back into subdirectory''-cdpath0&&gitmv../path1/COPYINGCOPYING+cdpath0&&gitmv../path1/COPYINGCOPYING'# in path0 currently test_expect_success'commiting the change''-cd..&&gitcommit-mmove-in-a+cd..&&gitcommit-mmove-in-a' test_expect_success'checking the commit''-gitdiff-tree-r-M--name-statusHEAD^HEAD>actual&&-grep"^R100..*path1/COPYING..*path0/COPYING"actual+gitdiff-tree-r-M--name-statusHEAD^HEAD>actual&&+grep"^R100..*path1/COPYING..*path0/COPYING"actual' test_expect_success'mv --dry-run does not move file''-gitmv-npath0/COPYINGMOVED&&-test-fpath0/COPYING&&-test!-fMOVED+gitmv-npath0/COPYINGMOVED&&+test-fpath0/COPYING&&+test!-fMOVED' test_expect_success'checking -k on non-existing file''-gitmv-kidontexistpath0+gitmv-kidontexistpath0' test_expect_success'checking -k on untracked file''-touchuntracked1&&-gitmv-kuntracked1path0&&-test-funtracked1&&-test!-fpath0/untracked1+touchuntracked1&&+gitmv-kuntracked1path0&&+test-funtracked1&&+test!-fpath0/untracked1' test_expect_success'checking -k on multiple untracked files''-touchuntracked2&&-gitmv-kuntracked1untracked2path0&&-test-funtracked1&&-test-funtracked2&&-test!-fpath0/untracked1&&-test!-fpath0/untracked2+touchuntracked2&&+gitmv-kuntracked1untracked2path0&&+test-funtracked1&&+test-funtracked2&&+test!-fpath0/untracked1&&+test!-fpath0/untracked2' test_expect_success'checking -f on untracked file with existing target''-touchpath0/untracked1&&-test_must_failgitmv-funtracked1path0&&-test!-f.git/index.lock&&-test-funtracked1&&-test-fpath0/untracked1+touchpath0/untracked1&&+test_must_failgitmv-funtracked1path0&&+test!-f.git/index.lock&&+test-funtracked1&&+test-fpath0/untracked1'# clean up the mess in case bad things happen
@@ -79,77 +79,77 @@ rm -f idontexist untracked1 untracked2 \ rmdirpath1 test_expect_success'moving to absent target with trailing slash''-test_must_failgitmvpath0/COPYINGno-such-dir/&&-test_must_failgitmvpath0/COPYINGno-such-dir//&&-gitmvpath0/no-such-dir/&&-test_path_is_dirno-such-dir+test_must_failgitmvpath0/COPYINGno-such-dir/&&+test_must_failgitmvpath0/COPYINGno-such-dir//&&+gitmvpath0/no-such-dir/&&+test_path_is_dirno-such-dir' test_expect_success'clean up''-gitreset--hard+gitreset--hard' test_expect_success'moving to existing untracked target with trailing slash''-mkdirpath1&&-gitmvpath0/path1/&&-test_path_is_dirpath1/path0/+mkdirpath1&&+gitmvpath0/path1/&&+test_path_is_dirpath1/path0/' test_expect_success'moving to existing tracked target with trailing slash''-mkdirpath2&&->path2/file&&gitaddpath2/file&&-gitmvpath1/path0/path2/&&-test_path_is_dirpath2/path0/+mkdirpath2&&+>path2/file&&gitaddpath2/file&&+gitmvpath1/path0/path2/&&+test_path_is_dirpath2/path0/' test_expect_success'clean up''-gitreset--hard+gitreset--hard' test_expect_success'adding another file''-cp"$TEST_DIRECTORY"/../README.mdpath0/README&&-gitaddpath0/README&&-gitcommit-madd2-a+cp"$TEST_DIRECTORY"/../README.mdpath0/README&&+gitaddpath0/README&&+gitcommit-madd2-a' test_expect_success'moving whole subdirectory''-gitmvpath0path2+gitmvpath0path2' test_expect_success'commiting the change''-gitcommit-mdir-move-a+gitcommit-mdir-move-a' test_expect_success'checking the commit''-gitdiff-tree-r-M--name-statusHEAD^HEAD>actual&&-grep"^R100..*path0/COPYING..*path2/COPYING"actual&&-grep"^R100..*path0/README..*path2/README"actual+gitdiff-tree-r-M--name-statusHEAD^HEAD>actual&&+grep"^R100..*path0/COPYING..*path2/COPYING"actual&&+grep"^R100..*path0/README..*path2/README"actual' test_expect_success'succeed when source is a prefix of destination''-gitmvpath2/COPYINGpath2/COPYING-renamed+gitmvpath2/COPYINGpath2/COPYING-renamed' test_expect_success'moving whole subdirectory into subdirectory''-gitmvpath2path1+gitmvpath2path1' test_expect_success'commiting the change''-gitcommit-mdir-move-a+gitcommit-mdir-move-a' test_expect_success'checking the commit''-gitdiff-tree-r-M--name-statusHEAD^HEAD>actual&&-grep"^R100..*path2/COPYING..*path1/path2/COPYING"actual&&-grep"^R100..*path2/README..*path1/path2/README"actual+gitdiff-tree-r-M--name-statusHEAD^HEAD>actual&&+grep"^R100..*path2/COPYING..*path1/path2/COPYING"actual&&+grep"^R100..*path2/README..*path1/path2/README"actual' test_expect_success'do not move directory over existing directory''-mkdirpath0&&mkdirpath0/path2&&test_must_failgitmvpath2path0+mkdirpath0&&mkdirpath0/path2&&test_must_failgitmvpath2path0' test_expect_success'move into "."''-gitmvpath1/path2/.+gitmvpath1/path2/.' test_expect_success"Michael Cassar's test case"'
Some tests use a deprecated style in which there are unnecessary
blank lines after the opening quote of the test body and before the
closing quote. So we should remove these unnecessary blank lines.
Signed-off-by: shubham verma <redacted>
---
t/t7001-mv.sh | 12 ------------
1 file changed, 12 deletions(-)
@@ -216,7 +212,6 @@ test_expect_success 'absolute pathname outside should fail' '(test-dsub&&!test-d../in&&gitls-files--error-unmatchsub/file-)' test_expect_success'git mv to move multiple sources into a directory''
@@ -232,7 +227,6 @@ test_expect_success 'git mv to move multiple sources into a directory' '' test_expect_success'git mv should not change sha1 of moved cache entry''-rm-fr.git&&gitinit&&echo1>dirty&&
@@ -243,7 +237,6 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' 'echo2>dirty2&&gitmvdirty2dirty&&["$entry"="$(gitls-files--stagedirty|cut-f1)"]-' rm-fdirtydirty2
@@ -266,7 +259,6 @@ test_expect_success 'git mv error on conflicted file' '' test_expect_success'git mv should overwrite symlink to a file''-rm-fr.git&&gitinit&&echo1>moved&&
@@ -279,13 +271,11 @@ test_expect_success 'git mv should overwrite symlink to a file' 'test"$(catsymlink)"=1&&gitupdate-index--refresh&&gitdiff-files--quiet-' rm-fmovedsymlink test_expect_success'git mv should overwrite file with a symlink''-rm-fr.git&&gitinit&&echo1>moved&&
@@ -296,11 +286,9 @@ test_expect_success 'git mv should overwrite file with a symlink' '!test-esymlink&&gitupdate-index--refresh&&gitdiff-files--quiet-' test_expect_successSYMLINKS'check moved symlink''-test-hmoved'
Some test use an old style for formatting subshells:
(command &&
...
Update them to the modern style:
(
command &&
...
Signed-off-by: shubham verma <redacted>
---
t/t7001-mv.sh | 74 ++++++++++++++++++++++++++++-----------------------
1 file changed, 40 insertions(+), 34 deletions(-)
@@ -181,38 +181,42 @@ test_expect_success "Sergey Vlasov's test case" 'gitmvaba'-test_expect_success'absolute pathname''(-rm-frmine&&-mkdirmine&&-cdmine&&-test_create_repoone&&-cdone&&-mkdirsub&&->sub/file&&-gitaddsub/file&&--gitmvsub"$(pwd)/in"&&-!test-dsub&&-test-din&&-gitls-files--error-unmatchin/file-)'--test_expect_success'absolute pathname outside should fail''(-rm-frmine&&-mkdirmine&&-cdmine&&-out=$(pwd)&&-test_create_repoone&&-cdone&&-mkdirsub&&->sub/file&&-gitaddsub/file&&--test_must_failgitmvsub"$out/out"&&-test-dsub&&-!test-d../in&&-gitls-files--error-unmatchsub/file-)'+test_expect_success'absolute pathname''+(+rm-frmine&&+mkdirmine&&+cdmine&&+test_create_repoone&&+cdone&&+mkdirsub&&+>sub/file&&+gitaddsub/file&&++gitmvsub"$(pwd)/in"&&+!test-dsub&&+test-din&&+gitls-files--error-unmatchin/file+)+'++test_expect_success'absolute pathname outside should fail''+(+rm-frmine&&+mkdirmine&&+cdmine&&+out=$(pwd)&&+test_create_repoone&&+cdone&&+mkdirsub&&+>sub/file&&+gitaddsub/file&&++test_must_failgitmvsub"$out/out"&&+test-dsub&&+!test-d../in&&+gitls-files--error-unmatchsub/file+)+' test_expect_success'git mv to move multiple sources into a directory''rm-fr.git&&gitinit&&
@@ -503,14 +507,16 @@ test_expect_success 'moving a submodule in nested directories' ' test_expect_success'moving nested submodules''gitcommit-am"cleanup commit"&&mkdirsub_nested_nested&&-(cdsub_nested_nested&&+(+cdsub_nested_nested&&touchnested_level2&&gitinit&&gitadd.&&gitcommit-m"nested level 2")&&mkdirsub_nested&&-(cdsub_nested&&+(+cdsub_nested&&touchnested_level1&&gitinit&&gitadd.&&
Change from old style to current style by taking advantage of
here-docs instead of echo commands.
Signed-off-by: shubham verma <redacted>
---
t/t7001-mv.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
@@ -226,7 +226,10 @@ test_expect_success 'git mv to move multiple sources into a directory' 'gitadddir/?.txt&&gitmvdir/a.txtdir/b.txtother&&gitls-files>actual&&-{echoother/a.txt;echoother/b.txt;}>expect&&+cat>expect<<-\EOF&&+other/a.txt+other/b.txt+EOFtest_cmpexpectactual'
Use `>` rather than `touch` to create an empty file when the
timestamp isn't relevant to the test.
Signed-off-by: shubham verma <redacted>
---
t/t7001-mv.sh | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
According to Documentation/CodingGuidelines, there should be no
whitespace after redirect operators. So, we should remove these
whitespaces after redirect operators.
Signed-off-by: shubham verma <redacted>
---
t/t7001-mv.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Avoid using `cd` outside of subshells since, if the test fails,
there is no guarantee that the current working directory is the
expected one, which may cause subsequent tests to run in the wrong
directory.
While at it, make some other tests more concise by replacing
simple subshells with `git -C`.
Signed-off-by: shubham verma <redacted>
---
t/t7001-mv.sh | 45 +++++++++++----------------------------------
1 file changed, 11 insertions(+), 34 deletions(-)
@@ -11,12 +11,11 @@ test_expect_success 'prepare reference tree' '' test_expect_success'moving the file out of subdirectory''-cdpath0&&gitmvCOPYING../path1/COPYING+git-Cpath0mvCOPYING../path1/COPYING'-# in path0 currently test_expect_success'commiting the change''-cd..&&gitcommit-mmove-out-a+gitcommit-mmove-out-a' test_expect_success'checking the commit''
@@ -25,12 +24,11 @@ test_expect_success 'checking the commit' '' test_expect_success'moving the file back into subdirectory''-cdpath0&&gitmv../path1/COPYINGCOPYING+git-Cpath0mv../path1/COPYINGCOPYING'-# in path0 currently test_expect_success'commiting the change''-cd..&&gitcommit-mmove-in-a+gitcommit-mmove-in-a' test_expect_success'checking the commit''
@@ -328,10 +326,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitmgitmvsubmod/sub&&!test-esub&&["$entry"="$(gitls-files--stagemod/sub|cut-f1)"]&&-(-cdmod/sub&&-gitstatus-)&&+git-Cmod/substatus&&gitupdate-index--refresh&&gitdiff-files--quiet'
@@ -351,10 +346,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodugitmvsubmod/sub&&!test-esub&&["$entry"="$(gitls-files--stagemod/sub|cut-f1)"]&&-(-cdmod/sub&&-gitstatus-)&&+git-Cmod/substatus&&echomod/sub>expected&&gitconfig-f.gitmodulessubmodule.sub.path>actual&&test_cmpexpectedactual&&
@@ -368,16 +360,10 @@ test_expect_success 'git mv moves a submodule with gitfile' 'gitsubmoduleupdate&&entry="$(gitls-files--stagesub|cut-f1)"&&mkdirmod&&-(-cdmod&&-gitmv../sub/.-)&&+git-Cmodmv../sub/.&&!test-esub&&["$entry"="$(gitls-files--stagemod/sub|cut-f1)"]&&-(-cdmod/sub&&-gitstatus-)&&+git-Cmod/substatus&&echomod/sub>expected&&gitconfig-f.gitmodulessubmodule.sub.path>actual&&test_cmpexpectedactual&&
@@ -396,10 +382,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' 'test_must_be_emptyactual.err&&!test-esub&&["$entry"="$(gitls-files--stagemod/sub|cut-f1)"]&&-(-cdmod/sub&&-gitstatus-)&&+git-Cmod/substatus&&gitupdate-index--refresh&&gitdiff-files--quiet'
@@ -420,10 +403,7 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless statest_must_be_emptyactual.err&&!test-esub&&["$entry"="$(gitls-files--stagemod/sub|cut-f1)"]&&-(-cdmod/sub&&-gitstatus-)&&+git-Cmod/substatus&&gitupdate-index--refresh&&gitdiff-files--quiet'
@@ -441,10 +421,7 @@ test_expect_success 'mv issues a warning when section is not found in .gitmoduletest_i18ncmpexpect.erractual.err&&!test-esub&&["$entry"="$(gitls-files--stagemod/sub|cut-f1)"]&&-(-cdmod/sub&&-gitstatus-)&&+git-Cmod/substatus&&gitupdate-index--refresh&&gitdiff-files--quiet'
Modern practice is to avoid multiple commands per line, and
instead place each command on its own line.
Signed-off-by: shubham verma <redacted>
---
t/t7001-mv.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
@@ -143,7 +143,9 @@ test_expect_success 'checking the commit' '' test_expect_success'do not move directory over existing directory''-mkdirpath0&&mkdirpath0/path2&&test_must_failgitmvpath2path0+mkdirpath0&&+mkdirpath0/path2&&+test_must_failgitmvpath2path0' test_expect_success'move into "."''
According to Documentation/CodingGuidelines, we should use "test"
rather than "[ ... ]" in shell scripts, so let's replace the
"[ ... ]" with "test" in the t7001 test script.
Signed-off-by: shubham verma <redacted>
---
t/t7001-mv.sh | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
@@ -240,10 +240,10 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' 'gitadddirty&&entry="$(gitls-files--stagedirty|cut-f1)"&&gitmvdirtydirty2&&-["$entry"="$(gitls-files--stagedirty2|cut-f1)"]&&+test"$entry"="$(gitls-files--stagedirty2|cut-f1)"&&echo2>dirty2&&gitmvdirty2dirty&&-["$entry"="$(gitls-files--stagedirty|cut-f1)"]+test"$entry"="$(gitls-files--stagedirty|cut-f1)"' rm-fdirtydirty2
@@ -330,7 +330,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitmmkdirmod&&gitmvsubmod/sub&&!test-esub&&-["$entry"="$(gitls-files--stagemod/sub|cut-f1)"]&&+test"$entry"="$(gitls-files--stagemod/sub|cut-f1)"&&git-Cmod/substatus&&gitupdate-index--refresh&&gitdiff-files--quiet
@@ -350,7 +350,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodumkdirmod&&gitmvsubmod/sub&&!test-esub&&-["$entry"="$(gitls-files--stagemod/sub|cut-f1)"]&&+test"$entry"="$(gitls-files--stagemod/sub|cut-f1)"&&git-Cmod/substatus&&echomod/sub>expected&&gitconfig-f.gitmodulessubmodule.sub.path>actual&&
@@ -367,7 +367,7 @@ test_expect_success 'git mv moves a submodule with gitfile' 'mkdirmod&&git-Cmodmv../sub/.&&!test-esub&&-["$entry"="$(gitls-files--stagemod/sub|cut-f1)"]&&+test"$entry"="$(gitls-files--stagemod/sub|cut-f1)"&&git-Cmod/substatus&&echomod/sub>expected&&gitconfig-f.gitmodulessubmodule.sub.path>actual&&
@@ -386,7 +386,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' 'gitmvsubmod/sub2>actual.err&&test_must_be_emptyactual.err&&!test-esub&&-["$entry"="$(gitls-files--stagemod/sub|cut-f1)"]&&+test"$entry"="$(gitls-files--stagemod/sub|cut-f1)"&&git-Cmod/substatus&&gitupdate-index--refresh&&gitdiff-files--quiet
@@ -407,7 +407,7 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless stagitmvsubmod/sub2>actual.err&&test_must_be_emptyactual.err&&!test-esub&&-["$entry"="$(gitls-files--stagemod/sub|cut-f1)"]&&+test"$entry"="$(gitls-files--stagemod/sub|cut-f1)"&&git-Cmod/substatus&&gitupdate-index--refresh&&gitdiff-files--quiet
@@ -425,7 +425,7 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodulegitmvsubmod/sub2>actual.err&&test_i18ncmpexpect.erractual.err&&!test-esub&&-["$entry"="$(gitls-files--stagemod/sub|cut-f1)"]&&+test"$entry"="$(gitls-files--stagemod/sub|cut-f1)"&&git-Cmod/substatus&&gitupdate-index--refresh&&gitdiff-files--quiet
From: Eric Sunshine <hidden> Date: 2021-02-09 19:39:44
On Tue, Feb 9, 2021 at 12:35 PM shubham verma [off-list ref] wrote:
In this patch series modernize the t7001 test script by changing the
style of its tests from an old one to the modern one and by cleaning
up the test script.
Changes since v1:
- Change commit messages and added brief explanation about commit.
- Modernize subshell formatting
- Use ': >' rather than '>'