]> git.ipfire.org Git - thirdparty/git.git/blob - t/t4121-apply-diffs.sh
Sync with Git 2.45.1
[thirdparty/git.git] / t / t4121-apply-diffs.sh
1 #!/bin/sh
2
3 test_description='git apply for contextually independent diffs'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
6
7 TEST_PASSES_SANITIZE_LEAK=true
8 . ./test-lib.sh
9
10 echo '1
11 2
12 3
13 4
14 5
15 6
16 7
17 8' >file
18
19 test_expect_success 'setup' \
20 'git add file &&
21 git commit -q -m 1 &&
22 git checkout -b test &&
23 mv file file.tmp &&
24 echo 0 >file &&
25 cat file.tmp >>file &&
26 rm file.tmp &&
27 git commit -a -q -m 2 &&
28 echo 9 >>file &&
29 git commit -a -q -m 3 &&
30 git checkout main'
31
32 test_expect_success \
33 'check if contextually independent diffs for the same file apply' \
34 '( git diff test~2 test~1 && git diff test~1 test~0 )| git apply'
35
36 test_done