]> git.ipfire.org Git - thirdparty/git.git/blame - t/t6435-merge-sparse.sh
Sync with Git 2.45.1
[thirdparty/git.git] / t / t6435-merge-sparse.sh
CommitLineData
b33fdfc3
MK
1#!/bin/sh
2
3test_description='merge with sparse files'
4
ead74601 5TEST_CREATE_REPO_NO_TEMPLATE=1
b5fcb1c0 6TEST_PASSES_SANITIZE_LEAK=true
b33fdfc3
MK
7. ./test-lib.sh
8
9# test_file $filename $content
10test_file () {
11 echo "$2" > "$1" &&
12 git add "$1"
13}
14
15# test_commit_this $message_and_tag
16test_commit_this () {
17 git commit -m "$1" &&
18 git tag "$1"
19}
20
21test_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
37test_expect_success 'reset --hard works after the conflict' '
38 git reset --hard
39'
40
41test_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
47test_expect_success 'setup: conflict back' '
d5bb92ec 48 test_must_fail git merge theirs
b33fdfc3
MK
49'
50
51test_expect_success 'Merge abort works after the conflict' '
52 git merge --abort
53'
54
55test_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
61test_done