{"thread":{"id":"1982","subject":"[PATCH] Fix handling of not_for_merge '.' flag in refspec.","startedAt":"2005-09-29T23:53:09Z","lastAt":"2005-09-30T00:47:39Z","messageCount":2,"participants":["Tom Prince","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"9521","messageId":"11280379894186-git-send-email-tom.prince@ualberta.net","threadId":"1982","inReplyTo":null,"subject":"[PATCH] Fix handling of not_for_merge '.' flag in refspec.","fromName":"Tom Prince","fromEmail":"tom.prince@ualberta.net","sentAt":"2005-09-29T23:53:09Z","receivedAt":"2005-09-29T23:53:09Z","isPatch":true,"sender":{"key":"tom.prince@ualberta.net","avatar":"https://gravatar.com/avatar/a0ad19caee7618876339485106ec994f5202505eecd210ba5c0bd869feaa555a?d=mp&s=160"},"body":"canon_refs_list_for_fetch did not know about '.', so it mangled any\nreference with it. Further, it added '.' to any refspec on the command\nline other than the first.\n\nSigned-off-by: Tom Prince <tom.prince@ualberta.net>\n\n\n---\n\n Documentation/pull-fetch-param.txt |    5 +++--\n git-parse-remote.sh                |   16 +++++++++++++++-\n 2 files changed, 18 insertions(+), 3 deletions(-)\n\n446dda983492e3c07dc73b271cb9208a4359a734\ndiff --git a/Documentation/pull-fetch-param.txt b/Documentation/pull-fetch-param.txt\n--- a/Documentation/pull-fetch-param.txt\n+++ b/Documentation/pull-fetch-param.txt\n@@ -49,7 +49,7 @@\n \n <refspec>::\n \tThe canonical format of a <refspec> parameter is\n-\t'+?<src>:<dst>'; that is, an optional plus '+', followed\n+\t'.?+?<src>:<dst>'; that is, an optional plus '+', followed\n \tby the source ref, followed by a colon ':', followed by\n \tthe destination ref.\n \n@@ -68,7 +68,8 @@\n \tref that matches it is fast forwarded using <src>.\n \tAgain, if the optional plus '+' is used, the local ref\n \tis updated even if it does not result in a fast forward\n-\tupdate.\n+\tupdate. If the optional dot '.' is used, the remote ref\n+\tis fetched, but not used for merging.\n \n \tSome short-cut notations are also supported.\n \ndiff --git a/git-parse-remote.sh b/git-parse-remote.sh\n--- a/git-parse-remote.sh\n+++ b/git-parse-remote.sh\n@@ -72,8 +72,15 @@ canon_refs_list_for_fetch () {\n \tdot_prefix=\n \tfor ref\n \tdo\n+\t\tnot_for_merge=\n \t\tforce=\n \t\tcase \"$ref\" in\n+\t\t.*)\n+\t\t\tref=$(expr \"$ref\" : '\\.\\(.*\\)')\n+\t\t\tnot_for_merge=.\n+\t\t\t;;\n+\t\tesac\n+\t\tcase \"$ref\" in\n \t\t+*)\n \t\t\tref=$(expr \"$ref\" : '\\+\\(.*\\)')\n \t\t\tforce=+\n@@ -94,7 +101,12 @@ canon_refs_list_for_fetch () {\n \t\theads/* | tags/* ) local=\"refs/$local\" ;;\n \t\t*) local=\"refs/heads/$local\" ;;\n \t\tesac\n-\t\techo \"${dot_prefix}${force}${remote}:${local}\"\n+\t\tcase \"$octopus$not_for_merge\" in\n+\t\t'')\t\n+\t\t\tnot_for_merge=$dot_prefix\n+\t\t\t;;\n+\t\tesac\n+\t\techo \"${not_for_merge}${force}${remote}:${local}\"\n \t\tdot_prefix=.\n \tdone\n }\n@@ -114,6 +126,7 @@ get_remote_default_refs_for_fetch () {\n \t\t# This prefixes the second and later default refspecs\n \t\t# with a '.', to signal git-fetch to mark them\n \t\t# not-for-merge.\n+\t\toctopus=\n \t\tcanon_refs_list_for_fetch $(sed -ne '/^Pull: */{\n \t\t\t\t\t\ts///p\n \t\t\t\t\t}' \"$GIT_DIR/remotes/$1\")\n@@ -155,6 +168,7 @@ get_remote_refs_for_fetch () {\n \t\t\t;;\n \t\t    esac\n \t\tfi\n+\t\toctopus=t\n \t\tcanon_refs_list_for_fetch \"$ref\"\n \t    done\n \t    ;;\n"},{"id":"9523","messageId":"7vk6gzcrf8.fsf@assigned-by-dhcp.cox.net","threadId":"1982","inReplyTo":"11280379894186-git-send-email-tom.prince@ualberta.net","subject":"Re: [PATCH] Fix handling of not_for_merge '.' flag in refspec.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-09-30T00:47:39Z","receivedAt":"2005-09-30T00:47:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Tom Prince <tom.prince@ualberta.net> writes:\n\n> canon_refs_list_for_fetch did not know about '.', so it mangled any\n> reference with it. Further, it added '.' to any refspec on the command\n> line other than the first.\n\nThe dot trick was supposed to be internal.  If you have the\nfollowing three lines in a remotes/xyzzy file:\n\n\tURL: http://xyzzy.xz/balances.git\n        Pull: frotz nitfol\n        Pull: rezrov\n\n    $ git pull xyzzy\n\n    - fetch frotz, nitfol, and rezrov; merge frotz into the\n      current branch\n\n    $ git pull xyzzy nitfol\n\n    - fetch nitfol only; merge nitfol into the current branch.\n\n    $ git pull xyzzy nitfol rezrov\n\n    - fetch nitfol and rezrov; merge them into the current\n      branch (an Octopus).\n\nThe '.' is in no way part of the <refspec> format.  It may not\nbe a bad idea to explicitly forbid it, but currently we don't.\n"}]}