{"thread":{"id":"40788","subject":"[PATCH] contrib/subtree: unwrap tag refs","startedAt":"2015-11-13T04:15:44Z","lastAt":"2016-01-13T17:40:01Z","messageCount":5,"participants":["Rob Mayoff","David A. Greene","Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"273259","messageId":"1447388144-23806-1-git-send-email-git@rob.dqd.com","threadId":"40788","inReplyTo":null,"subject":"[PATCH] contrib/subtree: unwrap tag refs","fromName":"Rob Mayoff","fromEmail":"mayoff@dqd.com","sentAt":"2015-11-13T04:15:44Z","receivedAt":"2015-11-13T04:15:44Z","isPatch":true,"sender":{"key":"mayoff@dqd.com","avatar":null},"body":"From: Rob Mayoff <mayoff@dqd.com>\n\nIf a subtree was added using a tag ref, the tag ref is stored in\nthe subtree commit message instead of the underlying commit's ref.\nTo split or push subsequent changes to the subtree, the subtree\ncommand needs to unwrap the tag ref.  This patch makes it do so.\n\nThe problem was described in a message to the mailing list from\nJunio C Hamano dated 29 Apr 2014, with the subject \"Re: git subtree\nissue in more recent versions\". The archived message can be found\nat <http://comments.gmane.org/gmane.comp.version-control.git/247503>.\n\nSigned-off-by: Rob Mayoff <mayoff@dqd.com>\n---\n contrib/subtree/git-subtree.sh | 10 ++++++++--\n 1 file changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 9f06571..b051600 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -245,7 +245,10 @@ find_latest_squash()\n \t\tcase \"$a\" in\n \t\t\tSTART) sq=\"$b\" ;;\n \t\t\tgit-subtree-mainline:) main=\"$b\" ;;\n-\t\t\tgit-subtree-split:) sub=\"$b\" ;;\n+\t\t\tgit-subtree-split:)\n+\t\t\t\tsub=\"$b\"\n+\t\t\t\tsub=\"$(git rev-parse \"$b^0\")\" || die \"could not rev-parse split hash $b from commit $sq\"\n+\t\t\t\t;;\n \t\t\tEND)\n \t\t\t\tif [ -n \"$sub\" ]; then\n \t\t\t\t\tif [ -n \"$main\" ]; then\n@@ -278,7 +281,10 @@ find_existing_splits()\n \t\tcase \"$a\" in\n \t\t\tSTART) sq=\"$b\" ;;\n \t\t\tgit-subtree-mainline:) main=\"$b\" ;;\n-\t\t\tgit-subtree-split:) sub=\"$b\" ;;\n+\t\t\tgit-subtree-split:)\n+\t\t\t\tsub=\"$b\"\n+\t\t\t\tsub=\"$(git rev-parse \"$b^0\")\" || die \"could not rev-parse split hash $b from commit $sq\"\n+\t\t\t\t;;\n \t\t\tEND)\n \t\t\t\tdebug \"  Main is: '$main'\"\n \t\t\t\tif [ -z \"$main\" -a -n \"$sub\" ]; then\n-- \n2.4.3\n"},{"id":"273260","messageId":"87h9kqwm67.fsf@waller.obbligato.org","threadId":"40788","inReplyTo":"1447388144-23806-1-git-send-email-git@rob.dqd.com","subject":"Re: [PATCH] contrib/subtree: unwrap tag refs","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2015-11-13T04:36:16Z","receivedAt":"2015-11-13T04:36:16Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"Rob Mayoff <mayoff@dqd.com> writes:\n\n> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\n> index 9f06571..b051600 100755\n> --- a/contrib/subtree/git-subtree.sh\n> +++ b/contrib/subtree/git-subtree.sh\n> @@ -245,7 +245,10 @@ find_latest_squash()\n>  \t\tcase \"$a\" in\n>  \t\t\tSTART) sq=\"$b\" ;;\n>  \t\t\tgit-subtree-mainline:) main=\"$b\" ;;\n> -\t\t\tgit-subtree-split:) sub=\"$b\" ;;\n> +\t\t\tgit-subtree-split:)\n> +\t\t\t\tsub=\"$b\"\n\nWhy include the above line?\n\n> +\t\t\t\tsub=\"$(git rev-parse \"$b^0\")\" || die \"could not rev-parse split hash $b from commit $sq\"\n\nThis seems like odd quoting.  Would not this do the same?\n\n\t\t\t\tsub=\"$(git rev-parse $b^0)\" || die \"could not rev-parse split hash $b from commit $sq\"\n\nPerhaps I am missing something.\n\n> +\t\t\t\t;;\n>  \t\t\tEND)\n>  \t\t\t\tif [ -n \"$sub\" ]; then\n>  \t\t\t\t\tif [ -n \"$main\" ]; then\n> @@ -278,7 +281,10 @@ find_existing_splits()\n>  \t\tcase \"$a\" in\n>  \t\t\tSTART) sq=\"$b\" ;;\n>  \t\t\tgit-subtree-mainline:) main=\"$b\" ;;\n> -\t\t\tgit-subtree-split:) sub=\"$b\" ;;\n> +\t\t\tgit-subtree-split:)\n> +\t\t\t\tsub=\"$b\"\n\nAnd here too.\n\n> +\t\t\t\tsub=\"$(git rev-parse \"$b^0\")\" || die \"could not rev-parse split hash $b from commit $sq\"\n\nSame as above.\n\n                        -David\n"},{"id":"273261","messageId":"20151113050123.GA29708@sigill.intra.peff.net","threadId":"40788","inReplyTo":"87h9kqwm67.fsf@waller.obbligato.org","subject":"Re: [PATCH] contrib/subtree: unwrap tag refs","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-11-13T05:01:24Z","receivedAt":"2015-11-13T05:01:24Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Nov 12, 2015 at 10:36:16PM -0600, David A. Greene wrote:\n\n> > +\t\t\t\tsub=\"$(git rev-parse \"$b^0\")\" || die \"could not rev-parse split hash $b from commit $sq\"\n> \n> This seems like odd quoting.  Would not this do the same?\n> \n> \t\t\t\tsub=\"$(git rev-parse $b^0)\" || die \"could not rev-parse split hash $b from commit $sq\"\n> \n> Perhaps I am missing something.\n\nThe former is quoting \"$b\" against whitespace splitting in the\nsub-command. Given that the value just came from a \"read\" call, I think\nby definition it cannot contains IFS. Still, quoting here is a good\nhabit.\n\nIt is actually the _outer_ quotes that are unnecessary, as variable\nassignment does not do extra splitting. So:\n\n  foo=$(echo one two)\n\nwill put the full \"one two\" into $foo. But the quotes do not hurt\nanything, and it is a reasonable style to use them to avoid this\ndiscussion. :)\n\nIt also matches style-wise with nearby assignments, like:\n\n  main=\"$b\"\n\n-Peff\n"},{"id":"275858","messageId":"87d1t6p5ov.fsf@waller.obbligato.org","threadId":"40788","inReplyTo":"87h9kqwm67.fsf@waller.obbligato.org","subject":"Re: [PATCH] contrib/subtree: unwrap tag refs","fromName":"David A. Greene","fromEmail":"greened@obbligato.org","sentAt":"2016-01-13T02:35:28Z","receivedAt":"2016-01-13T02:35:28Z","isPatch":true,"sender":{"key":"greened@obbligato.org","avatar":"https://avatars.githubusercontent.com/u/5291869?v=4"},"body":"I am sorry I neglected to follow-up on this.\n\ngreened@obbligato.org (David A. Greene) writes:\n\n> Rob Mayoff <mayoff@dqd.com> writes:\n>\n>> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\n>> index 9f06571..b051600 100755\n>> --- a/contrib/subtree/git-subtree.sh\n>> +++ b/contrib/subtree/git-subtree.sh\n>> @@ -245,7 +245,10 @@ find_latest_squash()\n>>  \t\tcase \"$a\" in\n>>  \t\t\tSTART) sq=\"$b\" ;;\n>>  \t\t\tgit-subtree-mainline:) main=\"$b\" ;;\n>> -\t\t\tgit-subtree-split:) sub=\"$b\" ;;\n>> +\t\t\tgit-subtree-split:)\n>> +\t\t\t\tsub=\"$b\"\n>\n> Why include the above line?\n\nMy bad.  Missed the diff markers.  This is fine.\n\n>> +\t\t\t\tsub=\"$(git rev-parse \"$b^0\")\" || die \"could not rev-parse split hash $b from commit $sq\"\n>\n> This seems like odd quoting.  Would not this do the same?\n>\n> \t\t\t\tsub=\"$(git rev-parse $b^0)\" || die \"could not rev-parse split hash $b from commit $sq\"\n>\n> Perhaps I am missing something.\n\nJeff explained it, so this is ok.\n\nThis all looks good to me.  Junio, please apply.\n\n                            -David\n"},{"id":"275942","messageId":"xmqq8u3tpedq.fsf@gitster.mtv.corp.google.com","threadId":"40788","inReplyTo":"87d1t6p5ov.fsf@waller.obbligato.org","subject":"Re: [PATCH] contrib/subtree: unwrap tag refs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-01-13T17:40:01Z","receivedAt":"2016-01-13T17:40:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"greened@obbligato.org (David A. Greene) writes:\n\n> I am sorry I neglected to follow-up on this.\n>\n> greened@obbligato.org (David A. Greene) writes:\n>\n>> Rob Mayoff <mayoff@dqd.com> writes:\n>>\n>>> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\n>>> index 9f06571..b051600 100755\n>>> --- a/contrib/subtree/git-subtree.sh\n>>> +++ b/contrib/subtree/git-subtree.sh\n>>> @@ -245,7 +245,10 @@ find_latest_squash()\n>>>  \t\tcase \"$a\" in\n>>>  \t\t\tSTART) sq=\"$b\" ;;\n>>>  \t\t\tgit-subtree-mainline:) main=\"$b\" ;;\n>>> -\t\t\tgit-subtree-split:) sub=\"$b\" ;;\n>>> +\t\t\tgit-subtree-split:)\n>>> +\t\t\t\tsub=\"$b\"\n>>\n>> Why include the above line?\n>\n> My bad.  Missed the diff markers.  This is fine.\n>\n>>> +\t\t\t\tsub=\"$(git rev-parse \"$b^0\")\" || die \"could not rev-parse split hash $b from commit $sq\"\n>>\n>> This seems like odd quoting.  Would not this do the same?\n>>\n>> \t\t\t\tsub=\"$(git rev-parse $b^0)\" || die \"could not rev-parse split hash $b from commit $sq\"\n>>\n>> Perhaps I am missing something.\n>\n> Jeff explained it, so this is ok.\n>\n> This all looks good to me.  Junio, please apply.\n>\n>                             -David\n\nThanks, all.  Let's mark rm/subtree-unwrap-tags topic to be merged\nto 'next', then.\n"}]}