aboutsummaryrefslogtreecommitdiff
path: root/contrib/subtree/t/t7900-subtree.sh
diff options
context:
space:
mode:
authorDavid Aguilar <davvid@gmail.com>2016-07-25 21:14:15 -0700
committerJunio C Hamano <gitster@pobox.com>2016-07-26 13:57:00 -0700
commit0f12c7d4d175bb0566208213b1b340b6794f305c (patch)
tree0974c3fb730d714476b5b50704fe129c1f2fb7b7 /contrib/subtree/t/t7900-subtree.sh
parentfbd3199a6d8c6b3fd1e9aa0034cee9a0c6a9bfb4 (diff)
downloadgit-0f12c7d4d175bb0566208213b1b340b6794f305c.tar.gz
git-0f12c7d4d175bb0566208213b1b340b6794f305c.tar.xz
subtree: fix "git subtree split --rejoin"
"git merge" in v2.9 prevents merging unrelated histories. "git subtree split --rejoin" creates unrelated histories when creating a split repo from a raw sub-directory that did not originate from an invocation of "git subtree add". Restore the original behavior by passing --allow-unrelated-histories when merging subtrees. This ensures that the synthetic history created by "git subtree split" can be merged. Add a test to ensure that this feature works as advertised. Reported-by: Brett Cundal <brett.cundal@iugome.com> Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/subtree/t/t7900-subtree.sh')
-rwxr-xr-xcontrib/subtree/t/t7900-subtree.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh
index 7e8be5adf..9751cfe9e 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -347,6 +347,22 @@ test_expect_success 'split sub dir/ with --rejoin' '
'
next_test
+test_expect_success 'split sub dir/ with --rejoin from scratch' '
+ subtree_test_create_repo "$subtree_test_count" &&
+ test_create_commit "$subtree_test_count" main1 &&
+ (
+ cd "$subtree_test_count" &&
+ mkdir "sub dir" &&
+ echo file >"sub dir"/file &&
+ git add "sub dir/file" &&
+ git commit -m"sub dir file" &&
+ split_hash=$(git subtree split --prefix="sub dir" --rejoin) &&
+ git subtree split --prefix="sub dir" --rejoin &&
+ check_equal "$(last_commit_message)" "Split '\''sub dir/'\'' into commit '\''$split_hash'\''"
+ )
+ '
+
+next_test
test_expect_success 'split sub dir/ with --rejoin and --message' '
subtree_test_create_repo "$subtree_test_count" &&
subtree_test_create_repo "$subtree_test_count/sub proj" &&