Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-12-23 09:48:11 +0300
committerJunio C Hamano <gitster@pobox.com>2021-12-23 09:48:11 +0300
commit62a3a27b915c5f2a70796af15678cce1079d200a (patch)
tree001177f82a93de8fa831e7134c4ddcfbeb030a24 /t/t4126-apply-empty.sh
parent553641555140a5aa4bab542246a401ea174364b7 (diff)
parent324eb77ee76277be99bdc54ef0b74ff30f5f567b (diff)
Merge branch 'jz/apply-quiet-and-allow-empty'
"git apply" has been taught to ignore a message without a patch with the "--allow-empty" option. It also learned to honor the "--quiet" option given from the command line. * jz/apply-quiet-and-allow-empty: git-apply: add --allow-empty flag git-apply: add --quiet flag
Diffstat (limited to 't/t4126-apply-empty.sh')
-rwxr-xr-xt/t4126-apply-empty.sh22
1 files changed, 18 insertions, 4 deletions
diff --git a/t/t4126-apply-empty.sh b/t/t4126-apply-empty.sh
index a361e79a81..82284d2f45 100755
--- a/t/t4126-apply-empty.sh
+++ b/t/t4126-apply-empty.sh
@@ -11,6 +11,8 @@ test_expect_success setup '
git add empty &&
test_tick &&
git commit -m initial &&
+ git commit --allow-empty -m "empty commit" &&
+ git format-patch --always HEAD~ >empty.patch &&
for i in a b c d e
do
echo $i
@@ -27,30 +29,42 @@ test_expect_success setup '
'
test_expect_success 'apply empty' '
- git reset --hard &&
rm -f missing &&
+ test_when_finished "git reset --hard" &&
git apply patch0 &&
test_cmp expect empty
'
+test_expect_success 'apply empty patch fails' '
+ test_when_finished "git reset --hard" &&
+ test_must_fail git apply empty.patch &&
+ test_must_fail git apply - </dev/null
+'
+
+test_expect_success 'apply with --allow-empty succeeds' '
+ test_when_finished "git reset --hard" &&
+ git apply --allow-empty empty.patch &&
+ git apply --allow-empty - </dev/null
+'
+
test_expect_success 'apply --index empty' '
- git reset --hard &&
rm -f missing &&
+ test_when_finished "git reset --hard" &&
git apply --index patch0 &&
test_cmp expect empty &&
git diff --exit-code
'
test_expect_success 'apply create' '
- git reset --hard &&
rm -f missing &&
+ test_when_finished "git reset --hard" &&
git apply patch1 &&
test_cmp expect missing
'
test_expect_success 'apply --index create' '
- git reset --hard &&
rm -f missing &&
+ test_when_finished "git reset --hard" &&
git apply --index patch1 &&
test_cmp expect missing &&
git diff --exit-code