apply: don't leak fd on fdopen() error
[git.git] / t / t6435-merge-sparse.sh
blob78628fb248ab6143ef83d11e819f15c30b52f278
1 #!/bin/sh
3 test_description='merge with sparse files'
5 TEST_CREATE_REPO_NO_TEMPLATE=1
6 TEST_PASSES_SANITIZE_LEAK=true
7 . ./test-lib.sh
9 # test_file $filename $content
10 test_file () {
11 echo "$2" > "$1" &&
12 git add "$1"
15 # test_commit_this $message_and_tag
16 test_commit_this () {
17 git commit -m "$1" &&
18 git tag "$1"
21 test_expect_success 'setup' '
22 test_file checked-out init &&
23 test_file modify_delete modify_delete_init &&
24 test_commit_this init &&
25 test_file modify_delete modify_delete_theirs &&
26 test_commit_this theirs &&
27 git reset --hard init &&
28 git rm modify_delete &&
29 test_commit_this ours &&
30 git config core.sparseCheckout true &&
31 mkdir .git/info &&
32 echo "/checked-out" >.git/info/sparse-checkout &&
33 git reset --hard &&
34 test_must_fail git merge theirs
37 test_expect_success 'reset --hard works after the conflict' '
38 git reset --hard
41 test_expect_success 'is reset properly' '
42 git status --porcelain -- modify_delete >out &&
43 test_must_be_empty out &&
44 test_path_is_missing modify_delete
47 test_expect_success 'setup: conflict back' '
48 test_must_fail git merge theirs
51 test_expect_success 'Merge abort works after the conflict' '
52 git merge --abort
55 test_expect_success 'is aborted properly' '
56 git status --porcelain -- modify_delete >out &&
57 test_must_be_empty out &&
58 test_path_is_missing modify_delete
61 test_done