Merge branch 'rm/subtree-unwrap-tags'
authorJunio C Hamano <gitster@pobox.com>
Fri, 22 Jan 2016 21:08:45 +0000 (13:08 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 22 Jan 2016 21:08:45 +0000 (13:08 -0800)
"git subtree" (in contrib/) records the tag object name in the
commit log message when a subtree is added using a tag, without
peeling it down to the underlying commit. The tag needs to be
peeled when "git subtree split" wants to work on the commit, but
the command forgot to do so.

* rm/subtree-unwrap-tags:
contrib/subtree: unwrap tag refs

1  2 
contrib/subtree/git-subtree.sh
index edf36f8c36091551d0a3e6cacb6c91446f0147eb,5ed0ea5e9485e07f176d1f54d92b9d03183d3304..efbdb720e6946dae85316ec98644187e4159ece4
@@@ -90,7 -90,7 +90,7 @@@ while [ $# -gt 0 ]; d
                --annotate) annotate="$1"; shift ;;
                --no-annotate) annotate= ;;
                -b) branch="$1"; shift ;;
 -              -P) prefix="$1"; shift ;;
 +              -P) prefix="${1%/}"; shift ;;
                -m) message="$1"; shift ;;
                --no-prefix) prefix= ;;
                --onto) onto="$1"; shift ;;
@@@ -245,7 -245,10 +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 +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
@@@ -648,7 -654,7 +654,7 @@@ cmd_split(
                debug "Merging split branch into HEAD..."
                latest_old=$(cache_get latest_old)
                git merge -s ours \
 -                      -m "$(rejoin_msg $dir $latest_old $latest_new)" \
 +                      -m "$(rejoin_msg "$dir" $latest_old $latest_new)" \
                        $latest_new >&2 || exit $?
        fi
        if [ -n "$branch" ]; then
@@@ -735,7 -741,7 +741,7 @@@ cmd_push(
            refspec=$2
            echo "git push using: " $repository $refspec
            localrev=$(git subtree split --prefix="$prefix") || die
 -          git push $repository $localrev:refs/heads/$refspec
 +          git push "$repository" $localrev:refs/heads/$refspec
        else
            die "'$dir' must already exist. Try 'git subtree add'."
        fi