mirror of
https://github.com/git/git.git
synced 2024-11-01 23:07:55 +01:00
Merge branch 'da/subtree-2.9-regression'
"git merge" in Git v2.9 was taught to forbid merging an unrelated lines of history by default, but that is exactly the kind of thing the "--rejoin" mode of "git subtree" (in contrib/) wants to do. "git subtree" has been taught to use the "--allow-unrelated-histories" option to override the default. * da/subtree-2.9-regression: subtree: fix "git subtree split --rejoin" t7900-subtree.sh: fix quoting and broken && chains
This commit is contained in:
commit
c0728edfb6
2 changed files with 25 additions and 8 deletions
|
@ -662,6 +662,7 @@ cmd_split()
|
||||||
debug "Merging split branch into HEAD..."
|
debug "Merging split branch into HEAD..."
|
||||||
latest_old=$(cache_get latest_old)
|
latest_old=$(cache_get latest_old)
|
||||||
git merge -s ours \
|
git merge -s ours \
|
||||||
|
--allow-unrelated-histories \
|
||||||
-m "$(rejoin_msg "$dir" $latest_old $latest_new)" \
|
-m "$(rejoin_msg "$dir" $latest_old $latest_new)" \
|
||||||
$latest_new >&2 || exit $?
|
$latest_new >&2 || exit $?
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -16,16 +16,16 @@ export TEST_DIRECTORY
|
||||||
|
|
||||||
subtree_test_create_repo()
|
subtree_test_create_repo()
|
||||||
{
|
{
|
||||||
test_create_repo "$1"
|
test_create_repo "$1" &&
|
||||||
(
|
(
|
||||||
cd $1
|
cd "$1" &&
|
||||||
git config log.date relative
|
git config log.date relative
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
create()
|
create()
|
||||||
{
|
{
|
||||||
echo "$1" >"$1"
|
echo "$1" >"$1" &&
|
||||||
git add "$1"
|
git add "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,12 +71,12 @@ join_commits()
|
||||||
}
|
}
|
||||||
|
|
||||||
test_create_commit() (
|
test_create_commit() (
|
||||||
repo=$1
|
repo=$1 &&
|
||||||
commit=$2
|
commit=$2 &&
|
||||||
cd "$repo"
|
cd "$repo" &&
|
||||||
mkdir -p $(dirname "$commit") \
|
mkdir -p "$(dirname "$commit")" \
|
||||||
|| error "Could not create directory for commit"
|
|| error "Could not create directory for commit"
|
||||||
echo "$commit" >"$commit"
|
echo "$commit" >"$commit" &&
|
||||||
git add "$commit" || error "Could not add commit"
|
git add "$commit" || error "Could not add commit"
|
||||||
git commit -m "$commit" || error "Could not commit"
|
git commit -m "$commit" || error "Could not commit"
|
||||||
)
|
)
|
||||||
|
@ -346,6 +346,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
|
next_test
|
||||||
test_expect_success 'split sub dir/ with --rejoin and --message' '
|
test_expect_success 'split sub dir/ with --rejoin and --message' '
|
||||||
subtree_test_create_repo "$subtree_test_count" &&
|
subtree_test_create_repo "$subtree_test_count" &&
|
||||||
|
|
Loading…
Reference in a new issue