{"thread":{"id":"13111","subject":"[PATCH] git-submodule - possibly use remote branch to describe a module","startedAt":"2008-04-14T23:52:34Z","lastAt":"2008-04-15T02:48:06Z","messageCount":5,"participants":["Mark Levedahl","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"74389","messageId":"1208217154-992-1-git-send-email-mlevedahl@gmail.com","threadId":"13111","inReplyTo":null,"subject":"[PATCH] git-submodule - possibly use remote branch to describe a module","fromName":"Mark Levedahl","fromEmail":"mlevedahl@gmail.com","sentAt":"2008-04-14T23:52:34Z","receivedAt":"2008-04-14T23:52:34Z","isPatch":true,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"Absent user intervention, git-submodule will maintain submodules as\nheadless checkouts of remote branches: such checkouts cannot be described\nwith reference to any local branch. So, allow describing the submodule\nusing remote branches before falling back on just using the commit id.\n\nSigned-off-by: Mark Levedahl <mlevedahl@gmail.com>\n---\n git-submodule.sh |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 28509ea..af195a7 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -389,7 +389,8 @@ set_name_rev () {\n \t\tcd \"$1\" && {\n \t\t\tgit describe \"$2\" 2>/dev/null ||\n \t\t\tgit describe --tags \"$2\" 2>/dev/null ||\n-\t\t\tgit describe --contains --tags --always \"$2\"\n+\t\t\tgit describe --contains \"$2\" 2>/dev/null ||\n+\t\t\tgit describe --all --always \"$2\"\n \t\t}\n \t) )\n \ttest -z \"$revname\" || revname=\" ($revname)\"\n-- \n1.5.5.65.gf482\n"},{"id":"74394","messageId":"7viqyk6je7.fsf@gitster.siamese.dyndns.org","threadId":"13111","inReplyTo":"1208217154-992-1-git-send-email-mlevedahl@gmail.com","subject":"Re: [PATCH] git-submodule - possibly use remote branch to describe a module","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-04-15T00:39:44Z","receivedAt":"2008-04-15T00:39:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Mark Levedahl <mlevedahl@gmail.com> writes:\n\n> Absent user intervention, git-submodule will maintain submodules as\n> headless checkouts of remote branches: such checkouts cannot be described\n> with reference to any local branch. So, allow describing the submodule\n> using remote branches before falling back on just using the commit id.\n>\n> Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>\n> ---\n>  git-submodule.sh |    3 ++-\n>  1 files changed, 2 insertions(+), 1 deletions(-)\n>\n> diff --git a/git-submodule.sh b/git-submodule.sh\n> index 28509ea..af195a7 100755\n> --- a/git-submodule.sh\n> +++ b/git-submodule.sh\n> @@ -389,7 +389,8 @@ set_name_rev () {\n>  \t\tcd \"$1\" && {\n>  \t\t\tgit describe \"$2\" 2>/dev/null ||\n>  \t\t\tgit describe --tags \"$2\" 2>/dev/null ||\n> -\t\t\tgit describe --contains --tags --always \"$2\"\n> +\t\t\tgit describe --contains \"$2\" 2>/dev/null ||\n> +\t\t\tgit describe --all --always \"$2\"\n>  \t\t}\n>  \t) )\n>  \ttest -z \"$revname\" || revname=\" ($revname)\"\n\nI think the new fallback sequence makes sense, but your explanation made\nsense for me only after reading it two and half times.\n\n - The original sequence ended with \"--contains --always\" which always\n   succeeded but with an abbrevated object name.  You removed --always\n   from it so that you can add a better last-ditch effort that uses remote\n   references.\n\n   Side note.  Removal of --tags from it is not justified in your log\n   message.  It is sort of obvious if you think about it, though...\n\n - The new one at the end uses --all because the HEAD is likely to be\n   describable with remote references, and without --all remote reference\n   namespace is not searched for a match.\n"},{"id":"74404","messageId":"48040B19.5030800@gmail.com","threadId":"13111","inReplyTo":"7viqyk6je7.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] git-submodule - possibly use remote branch to describe a module","fromName":"Mark Levedahl","fromEmail":"mlevedahl@gmail.com","sentAt":"2008-04-15T01:55:37Z","receivedAt":"2008-04-15T01:55:37Z","isPatch":true,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"Junio C Hamano wrote:\n>\n> I think the new fallback sequence makes sense, but your explanation made\n> sense for me only after reading it two and half times.\n>\n>   \nSo, would you like for me to attempt a better log message?\n\nMark\n"},{"id":"74406","messageId":"1208225951-1560-1-git-send-email-mlevedahl@gmail.com","threadId":"13111","inReplyTo":"7viqyk6je7.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] git-submodule - possibly use remote branch to describe a module","fromName":"Mark Levedahl","fromEmail":"mlevedahl@gmail.com","sentAt":"2008-04-15T02:19:11Z","receivedAt":"2008-04-15T02:19:11Z","isPatch":true,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"This changes the search logic for describing a submodule from:\n- local branch\n- tag\n- tag on a later commit\n- commit id\n\nto\n\n- local branch\n- tag\n- tag on a subsequent commit\n- remote branch\n- commit id\n\nThe change is describing with respect to a remote branch before falling\nback to the commit id. By itself, git-submodule will maintain submodules\nas headless checkouts without ever making a local branch. In\ngeneral, such heads cannot be described relative to a local branch but\ncan always be described relative to the remote branch.\n\nThis requires two describe steps in place of one: the first with\n\"--contains\" (and no \"--tags\" as that is implied by \"--contains\"), and\na new final step having \"--all --always\". The split is needed as\n\"--contains\" is incompatible with \"--all\".\n\nSigned-off-by: Mark Levedahl <mlevedahl@gmail.com>\n---\n git-submodule.sh |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 28509ea..af195a7 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -389,7 +389,8 @@ set_name_rev () {\n \t\tcd \"$1\" && {\n \t\t\tgit describe \"$2\" 2>/dev/null ||\n \t\t\tgit describe --tags \"$2\" 2>/dev/null ||\n-\t\t\tgit describe --contains --tags --always \"$2\"\n+\t\t\tgit describe --contains \"$2\" 2>/dev/null ||\n+\t\t\tgit describe --all --always \"$2\"\n \t\t}\n \t) )\n \ttest -z \"$revname\" || revname=\" ($revname)\"\n-- \n1.5.5.65.gf482\n"},{"id":"74407","messageId":"1208227686-696-1-git-send-email-mlevedahl@gmail.com","threadId":"13111","inReplyTo":"1208225951-1560-1-git-send-email-mlevedahl@gmail.com","subject":"[PATCH] git-submodule - possibly use branch name to describe a module","fromName":"Mark Levedahl","fromEmail":"mlevedahl@gmail.com","sentAt":"2008-04-15T02:48:06Z","receivedAt":"2008-04-15T02:48:06Z","isPatch":true,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"This changes the search logic for describing a submodule from:\n- annotated tag\n- any tag\n- tag on a subsequent commit\n- commit id\n\nto\n\n- annotated tag\n- any tag\n- tag on a subsequent commit\n- local or remote branch\n- commit id\n\nThe change is describing with respect to a branch before falling\nback to the commit id. By itself, git-submodule will maintain submodules\nas headless checkouts without ever making a local branch. In\ngeneral, such heads can always be described relative to the remote branch\nregardless of existence of tags, and so provides a better fallback\nsummary than just the commit id.\n\nThis requires inserting an extra describe step as --contains is\nincompatible with --all, but the latter can be used with --always\nto fall back to a commit ID. Also, --contains implies --tags, so the\nlatter is not needed.\n\nSigned-off-by: Mark Levedahl <mlevedahl@gmail.com>\n---\nOne more try - I mistakenly thought bare describe allowed\nlocal branches, not just tags, so the logic IS different.W Oops.\n\n git-submodule.sh |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 28509ea..af195a7 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -389,7 +389,8 @@ set_name_rev () {\n \t\tcd \"$1\" && {\n \t\t\tgit describe \"$2\" 2>/dev/null ||\n \t\t\tgit describe --tags \"$2\" 2>/dev/null ||\n-\t\t\tgit describe --contains --tags --always \"$2\"\n+\t\t\tgit describe --contains \"$2\" 2>/dev/null ||\n+\t\t\tgit describe --all --always \"$2\"\n \t\t}\n \t) )\n \ttest -z \"$revname\" || revname=\" ($revname)\"\n--\n1.5.5.65.gf482\n"}]}