{"thread":{"id":"3609","subject":"[PATCH] fetch/parse-remote: refs/remotes/* support","startedAt":"2006-03-09T11:54:52Z","lastAt":"2006-03-10T12:19:07Z","messageCount":5,"participants":["Eric Wong","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"17372","messageId":"20060309115452.GA13369@localdomain","threadId":"3609","inReplyTo":null,"subject":"[PATCH] fetch/parse-remote: refs/remotes/* support","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-03-09T11:54:52Z","receivedAt":"2006-03-09T11:54:52Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Signed-off-by: Eric Wong <normalperson@yhbt.net>\n\n---\n\n git-fetch.sh        |    5 ++++-\n git-parse-remote.sh |    8 ++++----\n 2 files changed, 8 insertions(+), 5 deletions(-)\n\n34f9d6c64bd686f29db4cd410882aab607e1b628\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex 0346d4a..2748573 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -103,6 +103,9 @@ append_fetch_head () {\n     refs/tags/*)\n \tnote_=\"$(expr \"$remote_name_\" : 'refs/tags/\\(.*\\)')\"\n \tnote_=\"tag '$note_' of \" ;;\n+    refs/remotes/*)\n+\tnote_=\"$(expr \"$remote_name_\" : 'refs/remotes/\\(.*\\)')\"\n+\tnote_=\"remote branch '$note_' of \" ;;\n     *)\n \tnote_=\"$remote_name of \" ;;\n     esac\n@@ -150,7 +153,7 @@ fast_forward_local () {\n \tgit-update-ref \"$1\" \"$2\" \n \t;;\n \n-    refs/heads/*)\n+    refs/heads/* | refs/remotes/*)\n \t# $1 is the ref being updated.\n \t# $2 is the new value for the ref.\n \tlocal=$(git-rev-parse --verify \"$1^0\" 2>/dev/null)\ndiff --git a/git-parse-remote.sh b/git-parse-remote.sh\nindex 5f158c6..63f2281 100755\n--- a/git-parse-remote.sh\n+++ b/git-parse-remote.sh\n@@ -86,14 +86,14 @@ canon_refs_list_for_fetch () {\n \t\tlocal=$(expr \"$ref\" : '[^:]*:\\(.*\\)')\n \t\tcase \"$remote\" in\n \t\t'') remote=HEAD ;;\n-\t\trefs/heads/* | refs/tags/*) ;;\n-\t\theads/* | tags/* ) remote=\"refs/$remote\" ;;\n+\t\trefs/heads/* | refs/tags/* | refs/remotes/*) ;;\n+\t\theads/* | tags/* | remotes/* ) remote=\"refs/$remote\" ;;\n \t\t*) remote=\"refs/heads/$remote\" ;;\n \t\tesac\n \t\tcase \"$local\" in\n \t\t'') local= ;;\n-\t\trefs/heads/* | refs/tags/*) ;;\n-\t\theads/* | tags/* ) local=\"refs/$local\" ;;\n+\t\trefs/heads/* | refs/tags/* | refs/remotes/*) ;;\n+\t\theads/* | tags/* | remotes/* ) local=\"refs/$local\" ;;\n \t\t*) local=\"refs/heads/$local\" ;;\n \t\tesac\n \n-- \n1.2.4.ga2910\n"},{"id":"17373","messageId":"20060309115535.GB13369@localdomain","threadId":"3609","inReplyTo":"20060309115452.GA13369@localdomain","subject":"[PATCH] clone: add refs/remotes/* to Pull: targets when cloning","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-03-09T11:55:35Z","receivedAt":"2006-03-09T11:55:35Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Signed-off-by: Eric Wong <normalperson@yhbt.net>\n\n---\n\n git-clone.sh |    6 ++++++\n 1 files changed, 6 insertions(+), 0 deletions(-)\n\nbe2db2344099b3713c1136e84bab7390b6198895\ndiff --git a/git-clone.sh b/git-clone.sh\nindex 4ed861d..a8ab7fd 100755\n--- a/git-clone.sh\n+++ b/git-clone.sh\n@@ -249,6 +249,12 @@ Pull: $head_points_at:$origin\" &&\n \t\t\ttest \"$origin\" = \"$head\" ||\n \t\t\techo \"Pull: ${head}:${head}\"\n \t\tdone >>\"$GIT_DIR/remotes/origin\"\n+\t\t(test -d \"$GIT_DIR\"/refs/remotes && cd \"$GIT_DIR\" &&\n+\t\t find \"refs/remotes\" -type f -print | sed -e 's|^refs/||') |\n+\t\twhile read ref\n+\t\tdo\n+\t\t\techo \"Pull: $ref:$ref\"\n+\t\tdone >>\"$GIT_DIR/remotes/origin\"\n \tesac\n \n \tcase \"$no_checkout\" in\n-- \n1.2.4.ga2910\n"},{"id":"17386","messageId":"7vzmjz5y6o.fsf@assigned-by-dhcp.cox.net","threadId":"3609","inReplyTo":"20060309115452.GA13369@localdomain","subject":"Re: [PATCH] fetch/parse-remote: refs/remotes/* support","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-03-09T17:23:59Z","receivedAt":"2006-03-09T17:23:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\n> @@ -103,6 +103,9 @@ append_fetch_head () {\n>      refs/tags/*)\n>  \tnote_=\"$(expr \"$remote_name_\" : 'refs/tags/\\(.*\\)')\"\n>  \tnote_=\"tag '$note_' of \" ;;\n> +    refs/remotes/*)\n> +\tnote_=\"$(expr \"$remote_name_\" : 'refs/remotes/\\(.*\\)')\"\n> +\tnote_=\"remote branch '$note_' of \" ;;\n>      *)\n>  \tnote_=\"$remote_name of \" ;;\n>      esac\n\nI vaguely recall that if you touch this part of the code you\nwould also need to check if fmt-merge-msg does sensible thing\nfor it.\n"},{"id":"17390","messageId":"7vfylr5vfs.fsf@assigned-by-dhcp.cox.net","threadId":"3609","inReplyTo":"20060309115535.GB13369@localdomain","subject":"Re: [PATCH] clone: add refs/remotes/* to Pull: targets when cloning","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-03-09T18:23:19Z","receivedAt":"2006-03-09T18:23:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n> diff --git a/git-clone.sh b/git-clone.sh\n> index 4ed861d..a8ab7fd 100755\n> --- a/git-clone.sh\n> +++ b/git-clone.sh\n> @@ -249,6 +249,12 @@ Pull: $head_points_at:$origin\" &&\n>  \t\t\ttest \"$origin\" = \"$head\" ||\n>  \t\t\techo \"Pull: ${head}:${head}\"\n>  \t\tdone >>\"$GIT_DIR/remotes/origin\"\n> +\t\t(test -d \"$GIT_DIR\"/refs/remotes && cd \"$GIT_DIR\" &&\n> +\t\t find \"refs/remotes\" -type f -print | sed -e 's|^refs/||') |\n> +\t\twhile read ref\n> +\t\tdo\n> +\t\t\techo \"Pull: $ref:$ref\"\n> +\t\tdone >>\"$GIT_DIR/remotes/origin\"\n>  \tesac\n\nI am not sure I agree with what you are doing here.  I thought\nthe idea behind refs/remotes is to migrate away from copying all\nthe remote heads into refs/heads (so that Linus does not need to\nsee my \"next\" and \"pu\" under his refs/heads), and putting\nforeign SCM tracking branches used by SVN and CVS importers in\nthere instead of in refs/heads naturally falls out from that\npattern.\n\nNow I do not propose to change the current clone that\ncontaminates the local branch namespace by copying remote\nrefs/heads into local refs/heads in the middle of v1.3.0\ndevelopment without laying out a transition plan, but I think\nthat is a sensible future direction.  Instead of copying\neverything from refs/heads to refs/heads, we only copy what\nremote HEAD points at to refs/heads/master to initialize the\nlocal clone, and copy everything from refs/heads to\nrefs/remotes, _and_ set up Pull: lines to do the same tracking.\nThe part of the code you are touching corresponds to the last\npart.\n\nWe would probably be better off not doing this right now.  When\nwe are sure everybody thinks it is a better approach to use\nrefs/remotes for remote branch tracking, we would need to change\nthe part you did not change (I think the clone-pack part is the\nhardest to change since it has a built-in \"copy refs to matching\nlocations\" logic) alongside with the part you touched with this\npatch to make things consistent.  At that time also you would\nneed to remove several lines above the part you touched so that\nwe do not use local refs/heads/* for tracking.\n\nHow does that sound?\n"},{"id":"17431","messageId":"20060310121907.GA15746@localdomain","threadId":"3609","inReplyTo":"7vzmjz5y6o.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] fetch,parse-remote,fmt-merge-msg: refs/remotes/* support","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-03-10T12:19:07Z","receivedAt":"2006-03-10T12:19:07Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Note: This replaces the previous patch to fetch and parse-remote.\n\nWe can now easily fetch and merge things from heads in the\nrefs/remotes/ hierarchy in remote repositories.\n\nThe refs/remotes/ hierarchy is likely to become the standard for\ntracking foreign SCMs, as well as the location of Pull: targets\nfor non-master heads of newly cloned repositories.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n\n---\n\n git-fetch.sh           |    8 +++++++-\n git-fmt-merge-msg.perl |    8 ++++++++\n git-parse-remote.sh    |    8 ++++----\n 3 files changed, 19 insertions(+), 5 deletions(-)\n\n6697c83da96b26739c3fe33c8526da6124cea909\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex 0346d4a..11e9a9d 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -94,6 +94,9 @@ append_fetch_head () {\n     # remote-nick is the URL given on the command line (or a shorthand)\n     # remote-name is the $GIT_DIR relative refs/ path we computed\n     # for this refspec.\n+\n+    # the $note_ variable will be fed to git-fmt-merge-msg for further\n+    # processing.\n     case \"$remote_name_\" in\n     HEAD)\n \tnote_= ;;\n@@ -103,6 +106,9 @@ append_fetch_head () {\n     refs/tags/*)\n \tnote_=\"$(expr \"$remote_name_\" : 'refs/tags/\\(.*\\)')\"\n \tnote_=\"tag '$note_' of \" ;;\n+    refs/remotes/*)\n+\tnote_=\"$(expr \"$remote_name_\" : 'refs/\\(remotes/.*\\)')\"\n+\tnote_=\"remote branch '$note_' of \" ;;\n     *)\n \tnote_=\"$remote_name of \" ;;\n     esac\n@@ -150,7 +156,7 @@ fast_forward_local () {\n \tgit-update-ref \"$1\" \"$2\" \n \t;;\n \n-    refs/heads/*)\n+    refs/heads/* | refs/remotes/*)\n \t# $1 is the ref being updated.\n \t# $2 is the new value for the ref.\n \tlocal=$(git-rev-parse --verify \"$1^0\" 2>/dev/null)\ndiff --git a/git-fmt-merge-msg.perl b/git-fmt-merge-msg.perl\nindex afe80e6..5986e54 100755\n--- a/git-fmt-merge-msg.perl\n+++ b/git-fmt-merge-msg.perl\n@@ -75,6 +75,7 @@ while (<>) {\n \t\t$src{$src} = {\n \t\t\tBRANCH => [],\n \t\t\tTAG => [],\n+\t\t\tR_BRANCH => [],\n \t\t\tGENERIC => [],\n \t\t\t# &1 == has HEAD.\n \t\t\t# &2 == has others.\n@@ -91,6 +92,11 @@ while (<>) {\n \t\tpush @{$src{$src}{TAG}}, $1;\n \t\t$src{$src}{HEAD_STATUS} |= 2;\n \t}\n+\telsif (/^remote branch (.*)$/) {\n+\t\t$origin = $1;\n+\t\tpush @{$src{$src}{R_BRANCH}}, $1;\n+\t\t$src{$src}{HEAD_STATUS} |= 2;\n+\t}\n \telsif (/^HEAD$/) {\n \t\t$origin = $src;\n \t\t$src{$src}{HEAD_STATUS} |= 1;\n@@ -123,6 +129,8 @@ for my $src (@src) {\n \t}\n \tpush @this, andjoin(\"branch \", \"branches \",\n \t\t\t   $src{$src}{BRANCH});\n+\tpush @this, andjoin(\"remote branch \", \"remote branches \",\n+\t\t\t   $src{$src}{R_BRANCH});\n \tpush @this, andjoin(\"tag \", \"tags \",\n \t\t\t   $src{$src}{TAG});\n \tpush @this, andjoin(\"commit \", \"commits \",\ndiff --git a/git-parse-remote.sh b/git-parse-remote.sh\nindex 5f158c6..63f2281 100755\n--- a/git-parse-remote.sh\n+++ b/git-parse-remote.sh\n@@ -86,14 +86,14 @@ canon_refs_list_for_fetch () {\n \t\tlocal=$(expr \"$ref\" : '[^:]*:\\(.*\\)')\n \t\tcase \"$remote\" in\n \t\t'') remote=HEAD ;;\n-\t\trefs/heads/* | refs/tags/*) ;;\n-\t\theads/* | tags/* ) remote=\"refs/$remote\" ;;\n+\t\trefs/heads/* | refs/tags/* | refs/remotes/*) ;;\n+\t\theads/* | tags/* | remotes/* ) remote=\"refs/$remote\" ;;\n \t\t*) remote=\"refs/heads/$remote\" ;;\n \t\tesac\n \t\tcase \"$local\" in\n \t\t'') local= ;;\n-\t\trefs/heads/* | refs/tags/*) ;;\n-\t\theads/* | tags/* ) local=\"refs/$local\" ;;\n+\t\trefs/heads/* | refs/tags/* | refs/remotes/*) ;;\n+\t\theads/* | tags/* | remotes/* ) local=\"refs/$local\" ;;\n \t\t*) local=\"refs/heads/$local\" ;;\n \t\tesac\n \n-- \n1.2.4.gbe2d\n"}]}