]> git.ipfire.org Git - thirdparty/git.git/blob - t/t6435-merge-sparse.sh
Merge branch 'jk/clone-allow-bare-and-o-together'
[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-lib.sh
7
8 # test_file $filename $content
9 test_file () {
10 echo "$2" > "$1" &&
11 git add "$1"
12 }
13
14 # test_commit_this $message_and_tag
15 test_commit_this () {
16 git commit -m "$1" &&
17 git tag "$1"
18 }
19
20 test_expect_success 'setup' '
21 test_file checked-out init &&
22 test_file modify_delete modify_delete_init &&
23 test_commit_this init &&
24 test_file modify_delete modify_delete_theirs &&
25 test_commit_this theirs &&
26 git reset --hard init &&
27 git rm modify_delete &&
28 test_commit_this ours &&
29 git config core.sparseCheckout true &&
30 mkdir .git/info &&
31 echo "/checked-out" >.git/info/sparse-checkout &&
32 git reset --hard &&
33 test_must_fail git merge theirs
34 '
35
36 test_expect_success 'reset --hard works after the conflict' '
37 git reset --hard
38 '
39
40 test_expect_success 'is reset properly' '
41 git status --porcelain -- modify_delete >out &&
42 test_must_be_empty out &&
43 test_path_is_missing modify_delete
44 '
45
46 test_expect_success 'setup: conflict back' '
47 test_must_fail git merge theirs
48 '
49
50 test_expect_success 'Merge abort works after the conflict' '
51 git merge --abort
52 '
53
54 test_expect_success 'is aborted properly' '
55 git status --porcelain -- modify_delete >out &&
56 test_must_be_empty out &&
57 test_path_is_missing modify_delete
58 '
59
60 test_done