From a9ebc43bd07e219922d1dab17df319f1cae5d600 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 26 Jul 2012 16:27:55 -0400 Subject: [PATCH] t7502: clean up fake_editor tests Using write_script saves us a few lines of code, and means we consistently use $SHELL_PATH. We can also drop the setting of the $pwd variable from $(pwd). In the first instance, there is no reason to use it (we can just use $(pwd) directly two lines later, since we are interpolating the here-document). In the second instance, it is totally pointless and probably just a cut-and-paste from the first instance. Finally, we can use a non-interpolating here document for the final script, which saves some quoting. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t7502-commit.sh | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh index 181456aa9..ddce53a96 100755 --- a/t/t7502-commit.sh +++ b/t/t7502-commit.sh @@ -266,13 +266,10 @@ test_expect_success 'committer is automatic' ' test_i18ncmp expect actual ' -pwd=`pwd` -cat >> .git/FAKE_EDITOR << EOF -#! /bin/sh -echo editor started > "$pwd/.git/result" +write_script .git/FAKE_EDITOR < "$(pwd)/.git/result" exit 0 EOF -chmod +x .git/FAKE_EDITOR test_expect_success 'do not fire editor in the presence of conflicts' ' @@ -300,9 +297,7 @@ test_expect_success 'do not fire editor in the presence of conflicts' ' test "$(cat .git/result)" = "editor not started" ' -pwd=`pwd` -cat >.git/FAKE_EDITOR <.git/FAKE_EDITOR <"\$1" + cat "$1.orig" +) >"$1" EOF echo '## Custom template' >template -- 2.26.2