summaryrefslogtreecommitdiff
path: root/t/t3401-rebase-and-am-rename.sh
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2018-08-29 07:06:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-08-30 14:58:59 (GMT)
commit6aba117d5cf7128e7bc942888263552fe927e13f (patch)
tree2cbc8868390321a969fa938a961bc618a9124d98 /t/t3401-rebase-and-am-rename.sh
parent5fdddd9b757a50c9a583936e7e6e44ec96d2d651 (diff)
downloadgit-6aba117d5cf7128e7bc942888263552fe927e13f.zip
git-6aba117d5cf7128e7bc942888263552fe927e13f.tar.gz
git-6aba117d5cf7128e7bc942888263552fe927e13f.tar.bz2
am: avoid directory rename detection when calling recursive merge machinery
Let's say you have the following three trees, where Base is from one commit behind either master or branch: Base : bar_v1, foo/{file1, file2, file3} branch: bar_v2, foo/{file1, file2}, goo/file3 master: bar_v3, foo/{file1, file2, file3} Using git-am (or am-based rebase) to apply the changes from branch onto master results in the following tree: Result: bar_merged, goo/{file1, file2, file3} This is not what users want; they did not rename foo/ -> goo/, they only renamed one file within that directory. The reason this happens is am constructs fake trees (via build_fake_ancestor()) of the following form: Base_bfa : bar_v1, foo/file3 branch_bfa: bar_v2, goo/file3 Combining these two trees with master's tree: master: bar_v3, foo/{file1, file2, file3}, You can see that merge_recursive_generic() would see branch_bfa as renaming foo/ -> goo/, and master as just adding both foo/file1 and foo/file2. As such, it ends up with goo/{file1, file2, file3} The core problem is that am does not have access to the original trees; it can only construct trees using the blobs involved in the patch. As such, it is not safe to perform directory rename detection within am -3. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3401-rebase-and-am-rename.sh')
-rwxr-xr-xt/t3401-rebase-and-am-rename.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t3401-rebase-and-am-rename.sh b/t/t3401-rebase-and-am-rename.sh
index 887bed5..e0b5111 100755
--- a/t/t3401-rebase-and-am-rename.sh
+++ b/t/t3401-rebase-and-am-rename.sh
@@ -152,7 +152,7 @@ test_expect_success 'rebase --interactive: NO directory rename' '
)
'
-test_expect_failure 'rebase (am): NO directory rename' '
+test_expect_success 'rebase (am): NO directory rename' '
test_when_finished "git -C no-dir-rename rebase --abort" &&
(
cd no-dir-rename &&
@@ -190,7 +190,7 @@ test_expect_success 'rebase --merge: NO directory rename' '
)
'
-test_expect_failure 'am: NO directory rename' '
+test_expect_success 'am: NO directory rename' '
test_when_finished "git -C no-dir-rename am --abort" &&
(
cd no-dir-rename &&