]> git.ipfire.org Git - thirdparty/git.git/blob - t/t6435-merge-sparse.sh
midx: disable replace objects
[thirdparty/git.git] / t / t6435-merge-sparse.sh
1 #!/bin/sh
2
3 test_description='merge with sparse files'
4
5 TEST_CREATE_REPO_NO_TEMPLATE=1
6 TEST_PASSES_SANITIZE_LEAK=true
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' '
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
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 &&
43 test_must_be_empty out &&
44 test_path_is_missing modify_delete
45 '
46
47 test_expect_success 'setup: conflict back' '
48 test_must_fail git merge theirs
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 &&
57 test_must_be_empty out &&
58 test_path_is_missing modify_delete
59 '
60
61 test_done