From: Rob Mayoff <mayoff@dqd.com>
To: git@vger.kernel.org
Cc: Rob Mayoff <mayoff@dqd.com>
Subject: [PATCH] contrib/subtree: unwrap tag refs
Date: Thu, 12 Nov 2015 22:15:44 -0600 [thread overview]
Message-ID: <1447388144-23806-1-git-send-email-git@rob.dqd.com> (raw)
From: Rob Mayoff <mayoff@dqd.com>
If a subtree was added using a tag ref, the tag ref is stored in
the subtree commit message instead of the underlying commit's ref.
To split or push subsequent changes to the subtree, the subtree
command needs to unwrap the tag ref. This patch makes it do so.
The problem was described in a message to the mailing list from
Junio C Hamano dated 29 Apr 2014, with the subject "Re: git subtree
issue in more recent versions". The archived message can be found
at <http://comments.gmane.org/gmane.comp.version-control.git/247503>.
Signed-off-by: Rob Mayoff <mayoff@dqd.com>
---
contrib/subtree/git-subtree.sh | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 9f06571..b051600 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -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="$b"
+ 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="$b"
+ 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
--
2.4.3
next reply other threads:[~2015-11-13 4:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-13 4:15 Rob Mayoff [this message]
2015-11-13 4:36 ` [PATCH] contrib/subtree: unwrap tag refs David A. Greene
2015-11-13 5:01 ` Jeff King
2016-01-13 2:35 ` David A. Greene
2016-01-13 17:40 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1447388144-23806-1-git-send-email-git@rob.dqd.com \
--to=mayoff@dqd.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).