]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4136-apply-check.sh
Merge branch 'bw/submodule-config-cleanup'
[thirdparty/git.git] / t / t4136-apply-check.sh
CommitLineData
cc64b318
BC
1#!/bin/sh
2
3test_description='git apply should exit non-zero with unrecognized input.'
4
5. ./test-lib.sh
6
7test_expect_success 'setup' '
8 test_commit 1
9'
10
11test_expect_success 'apply --check exits non-zero with unrecognized input' '
12 test_must_fail git apply --check - <<-\EOF
13 I am not a patch
14 I look nothing like a patch
15 git apply must fail
16 EOF
17'
18
ad6e8ed3
JH
19test_expect_success 'apply exits non-zero with no-op patch' '
20 cat >input <<-\EOF &&
21 diff --get a/1 b/1
22 index 6696ea4..606eddd 100644
23 --- a/1
24 +++ b/1
25 @@ -1,1 +1,1 @@
26 1
27 EOF
28 test_must_fail git apply --stat input &&
29 test_must_fail git apply --check input
30'
31
d70e9c5c
RS
32test_expect_success 'invalid combination: create and copy' '
33 test_must_fail git apply --check - <<-\EOF
34 diff --git a/1 b/2
35 new file mode 100644
36 copy from 1
37 copy to 2
38 EOF
39'
40
41test_expect_success 'invalid combination: create and rename' '
42 test_must_fail git apply --check - <<-\EOF
43 diff --git a/1 b/2
44 new file mode 100644
45 rename from 1
46 rename to 2
47 EOF
48'
49
cc64b318 50test_done