Max Kirillov | b33fdfc | 2018-07-10 22:17:48 +0300 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='merge with sparse files' |
| 4 | |
| 5 | . ./test-lib.sh |
| 6 | |
| 7 | # test_file $filename $content |
| 8 | test_file () { |
| 9 | echo "$2" > "$1" && |
| 10 | git add "$1" |
| 11 | } |
| 12 | |
| 13 | # test_commit_this $message_and_tag |
| 14 | test_commit_this () { |
| 15 | git commit -m "$1" && |
| 16 | git tag "$1" |
| 17 | } |
| 18 | |
| 19 | test_expect_success 'setup' ' |
Max Kirillov | b33fdfc | 2018-07-10 22:17:48 +0300 | [diff] [blame] | 20 | test_file checked-out init && |
| 21 | test_file modify_delete modify_delete_init && |
| 22 | test_commit_this init && |
| 23 | test_file modify_delete modify_delete_theirs && |
| 24 | test_commit_this theirs && |
| 25 | git reset --hard init && |
| 26 | git rm modify_delete && |
| 27 | test_commit_this ours && |
| 28 | git config core.sparseCheckout true && |
| 29 | echo "/checked-out" >.git/info/sparse-checkout && |
| 30 | git reset --hard && |
Elijah Newren | d5bb92e | 2020-02-27 00:14:22 +0000 | [diff] [blame] | 31 | test_must_fail git merge theirs |
Max Kirillov | b33fdfc | 2018-07-10 22:17:48 +0300 | [diff] [blame] | 32 | ' |
| 33 | |
| 34 | test_expect_success 'reset --hard works after the conflict' ' |
| 35 | git reset --hard |
| 36 | ' |
| 37 | |
| 38 | test_expect_success 'is reset properly' ' |
| 39 | git status --porcelain -- modify_delete >out && |
SZEDER Gábor | 1c5e94f | 2018-08-19 23:57:25 +0200 | [diff] [blame] | 40 | test_must_be_empty out && |
Max Kirillov | b33fdfc | 2018-07-10 22:17:48 +0300 | [diff] [blame] | 41 | test_path_is_missing modify_delete |
| 42 | ' |
| 43 | |
| 44 | test_expect_success 'setup: conflict back' ' |
Elijah Newren | d5bb92e | 2020-02-27 00:14:22 +0000 | [diff] [blame] | 45 | test_must_fail git merge theirs |
Max Kirillov | b33fdfc | 2018-07-10 22:17:48 +0300 | [diff] [blame] | 46 | ' |
| 47 | |
| 48 | test_expect_success 'Merge abort works after the conflict' ' |
| 49 | git merge --abort |
| 50 | ' |
| 51 | |
| 52 | test_expect_success 'is aborted properly' ' |
| 53 | git status --porcelain -- modify_delete >out && |
SZEDER Gábor | 1c5e94f | 2018-08-19 23:57:25 +0200 | [diff] [blame] | 54 | test_must_be_empty out && |
Max Kirillov | b33fdfc | 2018-07-10 22:17:48 +0300 | [diff] [blame] | 55 | test_path_is_missing modify_delete |
| 56 | ' |
| 57 | |
| 58 | test_done |