mirror of
https://github.com/git/git.git
synced 2024-11-19 23:44:50 +01:00
Merge remote branch 'origin/master'
* origin/master: Fixed regression with splitting out new subtree Use 'git merge -Xsubtree' when git version >= 1.7.0.
This commit is contained in:
commit
8e770bd389
2 changed files with 26 additions and 5 deletions
|
@ -257,6 +257,7 @@ find_existing_splits()
|
||||||
if [ -n "$main" -a -n "$sub" ]; then
|
if [ -n "$main" -a -n "$sub" ]; then
|
||||||
debug " Prior: $main -> $sub"
|
debug " Prior: $main -> $sub"
|
||||||
cache_set $main $sub
|
cache_set $main $sub
|
||||||
|
cache_set $sub $sub
|
||||||
try_remove_previous "$main"
|
try_remove_previous "$main"
|
||||||
try_remove_previous "$sub"
|
try_remove_previous "$sub"
|
||||||
fi
|
fi
|
||||||
|
@ -573,7 +574,9 @@ cmd_split()
|
||||||
# ugly. is there no better way to tell if this is a subtree
|
# ugly. is there no better way to tell if this is a subtree
|
||||||
# vs. a mainline commit? Does it matter?
|
# vs. a mainline commit? Does it matter?
|
||||||
if [ -z $tree ]; then
|
if [ -z $tree ]; then
|
||||||
cache_set $rev $rev
|
if [ -n "$newparents" ]; then
|
||||||
|
cache_set $rev $rev
|
||||||
|
fi
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -639,10 +642,19 @@ cmd_merge()
|
||||||
rev="$new"
|
rev="$new"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$message" ]; then
|
version=$(git version)
|
||||||
git merge -s subtree --message="$message" $rev
|
if [ "$version" \< "git version 1.7" ]; then
|
||||||
|
if [ -n "$message" ]; then
|
||||||
|
git merge -s subtree --message="$message" $rev
|
||||||
|
else
|
||||||
|
git merge -s subtree $rev
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
git merge -s subtree $rev
|
if [ -n "$message" ]; then
|
||||||
|
git merge -Xsubtree="$prefix" --message="$message" $rev
|
||||||
|
else
|
||||||
|
git merge -Xsubtree="$prefix" $rev
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
9
test.sh
9
test.sh
|
@ -294,6 +294,15 @@ git subtree split --prefix subdir --branch mainsub4
|
||||||
# but it wasn't, because it's cache was not set to itself)
|
# but it wasn't, because it's cache was not set to itself)
|
||||||
check_equal "$(git log --pretty=format:%P -1 mainsub4)" "$(git rev-parse sub3)"
|
check_equal "$(git log --pretty=format:%P -1 mainsub4)" "$(git rev-parse sub3)"
|
||||||
|
|
||||||
|
mkdir subdir2
|
||||||
|
create subdir2/main-sub5
|
||||||
|
git commit -m "main-sub5"
|
||||||
|
git subtree split --prefix subdir2 --branch mainsub5
|
||||||
|
|
||||||
|
# also test that we still can split out an entirely new subtree
|
||||||
|
# if the parent of the first commit in the tree isn't empty,
|
||||||
|
# then the new subtree has accidently been attached to something
|
||||||
|
check_equal "$(git log --pretty=format:%P -1 mainsub5)" ""
|
||||||
|
|
||||||
|
|
||||||
# make sure no patch changes more than one file. The original set of commits
|
# make sure no patch changes more than one file. The original set of commits
|
||||||
|
|
Loading…
Reference in a new issue