]>
Commit | Line | Data |
---|---|---|
b33fdfc3 MK |
1 | #!/bin/sh |
2 | ||
3 | test_description='merge with sparse files' | |
4 | ||
ead74601 | 5 | TEST_CREATE_REPO_NO_TEMPLATE=1 |
b5fcb1c0 | 6 | TEST_PASSES_SANITIZE_LEAK=true |
b33fdfc3 MK |
7 | . ./test-lib.sh |
8 | ||
9 | # test_file $filename $content | |
10 | test_file () { | |
11 | echo "$2" > "$1" && | |
12 | git add "$1" | |
13 | } | |
14 | ||
15 | # test_commit_this $message_and_tag | |
16 | test_commit_this () { | |
17 | git commit -m "$1" && | |
18 | git tag "$1" | |
19 | } | |
20 | ||
21 | test_expect_success 'setup' ' | |
b33fdfc3 MK |
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 && | |
ead74601 | 31 | mkdir .git/info && |
b33fdfc3 MK |
32 | echo "/checked-out" >.git/info/sparse-checkout && |
33 | git reset --hard && | |
d5bb92ec | 34 | test_must_fail git merge theirs |
b33fdfc3 MK |
35 | ' |
36 | ||
37 | test_expect_success 'reset --hard works after the conflict' ' | |
38 | git reset --hard | |
39 | ' | |
40 | ||
41 | test_expect_success 'is reset properly' ' | |
42 | git status --porcelain -- modify_delete >out && | |
1c5e94f4 | 43 | test_must_be_empty out && |
b33fdfc3 MK |
44 | test_path_is_missing modify_delete |
45 | ' | |
46 | ||
47 | test_expect_success 'setup: conflict back' ' | |
d5bb92ec | 48 | test_must_fail git merge theirs |
b33fdfc3 MK |
49 | ' |
50 | ||
51 | test_expect_success 'Merge abort works after the conflict' ' | |
52 | git merge --abort | |
53 | ' | |
54 | ||
55 | test_expect_success 'is aborted properly' ' | |
56 | git status --porcelain -- modify_delete >out && | |
1c5e94f4 | 57 | test_must_be_empty out && |
b33fdfc3 MK |
58 | test_path_is_missing modify_delete |
59 | ' | |
60 | ||
61 | test_done |