]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t4108: replace create_file with test_write_lines
authorDenton Liu <liu.denton@gmail.com>
Wed, 23 Oct 2019 23:32:28 +0000 (16:32 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 24 Oct 2019 02:32:53 +0000 (11:32 +0900)
Since the locally defined create_file() duplicates the functionality of
the test_write_lines() helper function, remove create_file() and replace
all instances with test_write_lines(). While we're at it, move
redirection operators to the end of the command which is the more
conventional place to put it.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t4108-apply-threeway.sh

index fa5d4efb89dc4ec83e3cd84fcb147958f361ab59..b109ecbd9fc76eb505d089f2b62bbb7d496eb0c1 100755 (executable)
@@ -4,13 +4,6 @@ test_description='git apply --3way'
 
 . ./test-lib.sh
 
-create_file () {
-       for i
-       do
-               echo "$i"
-       done
-}
-
 sanitize_conflicted_diff () {
        sed -e '
                /^index /d
@@ -20,7 +13,7 @@ sanitize_conflicted_diff () {
 
 test_expect_success setup '
        test_tick &&
-       create_file >one 1 2 3 4 5 6 7 &&
+       test_write_lines 1 2 3 4 5 6 7 >one &&
        cat one >two &&
        git add one two &&
        git commit -m initial &&
@@ -28,13 +21,13 @@ test_expect_success setup '
        git branch side &&
 
        test_tick &&
-       create_file >one 1 two 3 4 5 six 7 &&
-       create_file >two 1 two 3 4 5 6 7 &&
+       test_write_lines 1 two 3 4 5 six 7 >one &&
+       test_write_lines 1 two 3 4 5 6 7 >two &&
        git commit -a -m master &&
 
        git checkout side &&
-       create_file >one 1 2 3 4 five 6 7 &&
-       create_file >two 1 2 3 4 five 6 7 &&
+       test_write_lines 1 2 3 4 five 6 7 >one &&
+       test_write_lines 1 2 3 4 five 6 7 >two &&
        git commit -a -m side &&
 
        git checkout master
@@ -87,7 +80,7 @@ test_expect_success 'apply with --3way with rerere enabled' '
        test_must_fail git merge --no-commit side &&
 
        # Manually resolve and record the resolution
-       create_file 1 two 3 4 five six 7 >one &&
+       test_write_lines 1 two 3 4 five six 7 >one &&
        git rerere &&
        cat one >expect &&
 
@@ -104,14 +97,14 @@ test_expect_success 'apply -3 with add/add conflict setup' '
        git reset --hard &&
 
        git checkout -b adder &&
-       create_file 1 2 3 4 5 6 7 >three &&
-       create_file 1 2 3 4 5 6 7 >four &&
+       test_write_lines 1 2 3 4 5 6 7 >three &&
+       test_write_lines 1 2 3 4 5 6 7 >four &&
        git add three four &&
        git commit -m "add three and four" &&
 
        git checkout -b another adder^ &&
-       create_file 1 2 3 4 5 6 7 >three &&
-       create_file 1 2 3 four 5 6 7 >four &&
+       test_write_lines 1 2 3 4 5 6 7 >three &&
+       test_write_lines 1 2 3 four 5 6 7 >four &&
        git add three four &&
        git commit -m "add three and four" &&