mirror of
https://github.com/git/git
synced 2024-08-24 02:11:08 +00:00
Merge branch 'jc/t6424-failing-merge-preserve-local-changes'
The tests that ensured merges stop when interfering local changes are present did not make sure that local changes are preserved; now they do. * jc/t6424-failing-merge-preserve-local-changes: t6424: make sure a failed merge preserves local changes
This commit is contained in:
commit
5a10f4c3a1
|
@ -71,7 +71,9 @@ test_expect_success 'ff update' '
|
|||
git merge E^0 &&
|
||||
|
||||
test_must_fail git rev-parse HEAD:random_file &&
|
||||
test "$(git diff --name-only --cached E)" = "random_file"
|
||||
test "$(git diff --name-only --cached E)" = "random_file" &&
|
||||
test_path_is_file random_file &&
|
||||
git rev-parse --verify :random_file
|
||||
'
|
||||
|
||||
test_expect_success 'ff update, important file modified' '
|
||||
|
@ -83,6 +85,8 @@ test_expect_success 'ff update, important file modified' '
|
|||
git add subdir/e &&
|
||||
|
||||
test_must_fail git merge E^0 &&
|
||||
test_path_is_file subdir/e &&
|
||||
git rev-parse --verify :subdir/e &&
|
||||
test_path_is_missing .git/MERGE_HEAD
|
||||
'
|
||||
|
||||
|
@ -93,6 +97,8 @@ test_expect_success 'resolve, trivial' '
|
|||
touch random_file && git add random_file &&
|
||||
|
||||
test_must_fail git merge -s resolve C^0 &&
|
||||
test_path_is_file random_file &&
|
||||
git rev-parse --verify :random_file &&
|
||||
test_path_is_missing .git/MERGE_HEAD
|
||||
'
|
||||
|
||||
|
@ -103,6 +109,8 @@ test_expect_success 'resolve, non-trivial' '
|
|||
touch random_file && git add random_file &&
|
||||
|
||||
test_must_fail git merge -s resolve D^0 &&
|
||||
test_path_is_file random_file &&
|
||||
git rev-parse --verify :random_file &&
|
||||
test_path_is_missing .git/MERGE_HEAD
|
||||
'
|
||||
|
||||
|
@ -113,6 +121,8 @@ test_expect_success 'recursive' '
|
|||
touch random_file && git add random_file &&
|
||||
|
||||
test_must_fail git merge -s recursive C^0 &&
|
||||
test_path_is_file random_file &&
|
||||
git rev-parse --verify :random_file &&
|
||||
test_path_is_missing .git/MERGE_HEAD
|
||||
'
|
||||
|
||||
|
@ -145,9 +155,12 @@ test_expect_success 'recursive, when file has staged changes not matching HEAD n
|
|||
mkdir subdir &&
|
||||
test_seq 1 10 >subdir/a &&
|
||||
git add subdir/a &&
|
||||
git rev-parse --verify :subdir/a >expect &&
|
||||
|
||||
# We have staged changes; merge should error out
|
||||
test_must_fail git merge -s recursive E^0 2>err &&
|
||||
git rev-parse --verify :subdir/a >actual &&
|
||||
test_cmp expect actual &&
|
||||
test_i18ngrep "changes to the following files would be overwritten" err
|
||||
'
|
||||
|
||||
|
@ -158,9 +171,12 @@ test_expect_success 'recursive, when file has staged changes matching what a mer
|
|||
mkdir subdir &&
|
||||
test_seq 1 11 >subdir/a &&
|
||||
git add subdir/a &&
|
||||
git rev-parse --verify :subdir/a >expect &&
|
||||
|
||||
# We have staged changes; merge should error out
|
||||
test_must_fail git merge -s recursive E^0 2>err &&
|
||||
git rev-parse --verify :subdir/a >actual &&
|
||||
test_cmp expect actual &&
|
||||
test_i18ngrep "changes to the following files would be overwritten" err
|
||||
'
|
||||
|
||||
|
@ -171,7 +187,9 @@ test_expect_success 'octopus, unrelated file touched' '
|
|||
touch random_file && git add random_file &&
|
||||
|
||||
test_must_fail git merge C^0 D^0 &&
|
||||
test_path_is_missing .git/MERGE_HEAD
|
||||
test_path_is_missing .git/MERGE_HEAD &&
|
||||
git rev-parse --verify :random_file &&
|
||||
test_path_exists random_file
|
||||
'
|
||||
|
||||
test_expect_success 'octopus, related file removed' '
|
||||
|
@ -181,6 +199,8 @@ test_expect_success 'octopus, related file removed' '
|
|||
git rm b &&
|
||||
|
||||
test_must_fail git merge C^0 D^0 &&
|
||||
test_path_is_missing b &&
|
||||
test_must_fail git rev-parse --verify :b &&
|
||||
test_path_is_missing .git/MERGE_HEAD
|
||||
'
|
||||
|
||||
|
@ -189,8 +209,12 @@ test_expect_success 'octopus, related file modified' '
|
|||
git checkout B^0 &&
|
||||
|
||||
echo 12 >>a && git add a &&
|
||||
git rev-parse --verify :a >expect &&
|
||||
|
||||
test_must_fail git merge C^0 D^0 &&
|
||||
test_path_is_file a &&
|
||||
git rev-parse --verify :a >actual &&
|
||||
test_cmp expect actual &&
|
||||
test_path_is_missing .git/MERGE_HEAD
|
||||
'
|
||||
|
||||
|
@ -201,6 +225,8 @@ test_expect_success 'ours' '
|
|||
touch random_file && git add random_file &&
|
||||
|
||||
test_must_fail git merge -s ours C^0 &&
|
||||
test_path_is_file random_file &&
|
||||
git rev-parse --verify :random_file &&
|
||||
test_path_is_missing .git/MERGE_HEAD
|
||||
'
|
||||
|
||||
|
@ -211,6 +237,8 @@ test_expect_success 'subtree' '
|
|||
touch random_file && git add random_file &&
|
||||
|
||||
test_must_fail git merge -s subtree E^0 &&
|
||||
test_path_is_file random_file &&
|
||||
git rev-parse --verify :random_file &&
|
||||
test_path_is_missing .git/MERGE_HEAD
|
||||
'
|
||||
|
||||
|
|
Loading…
Reference in a new issue