зеркало из https://github.com/microsoft/git.git
Tighten and correct a few testcases for merging and cherry-picking
t3501 had a testcase originally added in05f2dfb965
(cherry-pick: demonstrate a segmentation fault, 2016-11-26) to ensure cherry-pick wouldn't segfault when working with a dirty file involved in a rename. While the segfault was fixed, there was another problem this test demonstrated: namely, that git would overwrite a dirty file involved in a rename. Further, the test encoded a "successful merge" and overwriting of this file as correct behavior. Modify the test so that it would still catch the segfault, but to require the correct behavior. Mark it as test_expect_failure for now too, since this second bug is not yet fixed. t7607 had a test added in30fd3a5425
(merge overwrites unstaged changes in renamed file, 2012-04-15) specific to looking for a merge overwriting a dirty file involved in a rename, but it too actually encoded what I would term incorrect behavior: it expected the merge to succeed. Fix that, and add a few more checks to make sure that the merge really does produce the expected results. Reviewed-By: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
2512f15446
Коммит
7c5585ff48
|
@ -141,7 +141,7 @@ test_expect_success 'cherry-pick "-" works with arguments' '
|
|||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'cherry-pick works with dirty renamed file' '
|
||||
test_expect_failure 'cherry-pick works with dirty renamed file' '
|
||||
test_commit to-rename &&
|
||||
git checkout -b unrelated &&
|
||||
test_commit unrelated &&
|
||||
|
@ -150,7 +150,10 @@ test_expect_success 'cherry-pick works with dirty renamed file' '
|
|||
test_tick &&
|
||||
git commit -m renamed &&
|
||||
echo modified >renamed &&
|
||||
git cherry-pick refs/heads/unrelated
|
||||
test_must_fail git cherry-pick refs/heads/unrelated >out &&
|
||||
test_i18ngrep "Refusing to lose dirty file at renamed" out &&
|
||||
test $(git rev-parse :0:renamed) = $(git rev-parse HEAD^:to-rename.t) &&
|
||||
grep -q "^modified$" renamed
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
|
@ -97,7 +97,10 @@ test_expect_failure 'will not overwrite unstaged changes in renamed file' '
|
|||
git mv c1.c other.c &&
|
||||
git commit -m rename &&
|
||||
cp important other.c &&
|
||||
git merge c1a &&
|
||||
test_must_fail git merge c1a >out &&
|
||||
test_i18ngrep "Refusing to lose dirty file at other.c" out &&
|
||||
test_path_is_file other.c~HEAD &&
|
||||
test $(git hash-object other.c~HEAD) = $(git rev-parse c1a:c1.c) &&
|
||||
test_cmp important other.c
|
||||
'
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче