From: SZEDER Gábor Date: Thu, 24 Mar 2016 11:00:59 GMT Subject: [PATCH v9 2/3] t7507-commit-verbose: make test suite use write_script Message-ID: <1458817259-11675-1-git-send-email-szeder@ira.uka.de> In-Reply-To: <01020153a7ba4eae-9b88e119-0505-418f-a137-595250edaa9d-000000@eu-west-1.amazonses.com> > Also remove test_set_editor from global scope and use it in whichever > test it is required. Why? test_set_editor sets and exports shell variables. Since you don't invoke test_set_editor in a subshell, after the first invocation the editor will be part of the global scope anyway. Also missing signoff. > --- > t/t7507-commit-verbose.sh | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh > index 2ddf28c..cf95efb 100755 > --- a/t/t7507-commit-verbose.sh > +++ b/t/t7507-commit-verbose.sh > @@ -3,12 +3,11 @@ > test_description='verbose commit template' > . ./test-lib.sh > > -cat >check-for-diff < -#!$SHELL_PATH > -exec grep '^diff --git' "\$1" > +write_script "check-for-diff" <<-\EOF && > +grep '^diff --git' "$1" >out && > +test $(wc -l EOF > chmod +x check-for-diff > -test_set_editor "$PWD/check-for-diff" > > cat >message <<'EOF' > subject > @@ -23,6 +22,7 @@ test_expect_success 'setup' ' > ' > > test_expect_success 'initial commit shows verbose diff' ' > + test_set_editor "$PWD/check-for-diff" && > git commit --amend -v > ' > > @@ -38,11 +38,13 @@ check_message() { > } > > test_expect_success 'verbose diff is stripped out' ' > + test_set_editor "$PWD/check-for-diff" && > git commit --amend -v && > check_message message > ' > > test_expect_success 'verbose diff is stripped out (mnemonicprefix)' ' > + test_set_editor "$PWD/check-for-diff" && > git config diff.mnemonicprefix true && > git commit --amend -v && > check_message message > @@ -66,11 +68,13 @@ test_expect_success 'diff in message is retained without -v' ' > ' > > test_expect_success 'diff in message is retained with -v' ' > + test_set_editor "$PWD/check-for-diff" && > git commit --amend -F diff -v && > check_message diff > ' > > test_expect_success 'submodule log is stripped out too with -v' ' > + test_set_editor "$PWD/check-for-diff" && > git config diff.submodule log && > git submodule add ./. sub && > git commit -m "sub added" && > > -- > https://github.com/git/git/pull/218 >