Merge branch 'jk/parse-options-concat'
[gitweb.git] / contrib / subtree / git-subtree.sh
index 5c8372709b31b4ecd8caf0e05faedd0626f03021..b567eaeff97bca0b42c7217a99cd73ea4b191f07 100755 (executable)
@@ -245,7 +245,10 @@ find_latest_squash()
                case "$a" in
                        START) sq="$b" ;;
                        git-subtree-mainline:) main="$b" ;;
-                       git-subtree-split:) sub="$b" ;;
+                       git-subtree-split:)
+                               sub="$(git rev-parse "$b^0")" ||
+                                   die "could not rev-parse split hash $b from commit $sq"
+                               ;;
                        END)
                                if [ -n "$sub" ]; then
                                        if [ -n "$main" ]; then
@@ -278,7 +281,10 @@ find_existing_splits()
                case "$a" in
                        START) sq="$b" ;;
                        git-subtree-mainline:) main="$b" ;;
-                       git-subtree-split:) sub="$b" ;;
+                       git-subtree-split:)
+                               sub="$(git rev-parse "$b^0")" ||
+                                   die "could not rev-parse split hash $b from commit $sq"
+                               ;;
                        END)
                                debug "  Main is: '$main'"
                                if [ -z "$main" -a -n "$sub" ]; then
@@ -656,6 +662,7 @@ cmd_split()
                debug "Merging split branch into HEAD..."
                latest_old=$(cache_get latest_old)
                git merge -s ours \
+                       --allow-unrelated-histories \
                        -m "$(rejoin_msg "$dir" $latest_old $latest_new)" \
                        $latest_new >&2 || exit $?
        fi