From: Junio C Hamano Date: Fri, 22 Jan 2016 21:08:45 +0000 (-0800) Subject: Merge branch 'rm/subtree-unwrap-tags' X-Git-Tag: v2.8.0-rc0~104 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/a039a79e9d00fed442f31ce69054e98e7dd1fc69?ds=inline;hp=-c Merge branch 'rm/subtree-unwrap-tags' "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 --- a039a79e9d00fed442f31ce69054e98e7dd1fc69 diff --combined contrib/subtree/git-subtree.sh index edf36f8c36,5ed0ea5e94..efbdb720e6 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@@ -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