Interdiff between v2 and v2.5:
- Rename $message to $tag, as that fits its purpose better, and quote it.
- Quote $@.
- Use the most common sed invocation from t/ for getting the last line of
  a file, for consistency.
- Use apply --index to make sure we notice if the generated diff adds or
  deletes files unintendedly.
---
 t/t4051-diff-function-context.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/t/t4051-diff-function-context.sh b/t/t4051-diff-function-context.sh
index 88a3308..b6bb04a 100755
--- a/t/t4051-diff-function-context.sh
+++ b/t/t4051-diff-function-context.sh
@@ -7,12 +7,12 @@ test_description='diff function context'
 dir="$TEST_DIRECTORY/t4051"
 
 commit_and_tag () {
-       message=$1 &&
+       tag=$1 &&
        shift &&
-       git add $@ &&
+       git add "$@" &&
        test_tick &&
-       git commit -m $message &&
-       git tag $message
+       git commit -m "$tag" &&
+       git tag "$tag"
 }
 
 first_context_line () {
@@ -23,7 +23,7 @@ first_context_line () {
 }
 
 last_context_line () {
-       sed -n '$ p'
+       sed -ne \$p
 }
 
 check_diff () {
@@ -38,7 +38,7 @@ check_diff () {
        test_expect_success ' diff applies' '
                test_when_finished "git reset --hard" &&
                git checkout --detach "$name^" &&
-               git apply "$name.diff" &&
+               git apply --index "$name.diff" &&
                git diff --exit-code "$name"
        '
 }
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to