From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Cc: Daniel Barkalow <barkalow@iabervon.org>
Subject: [PATCH] Set up remotes/origin to track all remote branches.
Date: Sun, 06 Nov 2005 01:23:53 -0800 [thread overview]
Message-ID: <7v1x1u1652.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: Pine.LNX.4.64.0511041745480.25300@iabervon.org
Daniel Barkalow <barkalow@iabervon.org> writes:
> On Thu, 3 Nov 2005, Junio C Hamano wrote:
>
>> My "guinea pig" repository has this in $GIT_DIR/remotes/origin:
>>
>> URL: git://git.kernel.org/pub/scm/git/git.git
>> Pull: master:origin
>> Pull: +pu:pu
>> Pull: maint:maint
>
> Shouldn't approximately this be what git-clone sets up for you? If it's
> getting those heads initially, it should keep the information for future
> use. The only thing it wouldn't know would be the "+" on pu.
I think this makes sense, and especially so, once we later
change the default behaviour of 'git clone' to clone but rename
the remote refs to somewhere else.
-- >8 -- cut here -- >8 --
This implements the idea Daniel Barkalow came up with, to match
the remotes/origin created by clone by default to the workflow I
use myself in my guinea pig repository, to have me eat my own
dog food.
We probably would want to use either .git/refs/local/heads/*
(idea by Linus) or .git/refs/heads/origin/* instead to reduce
the local ref namespace pollution.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
Documentation/git-clone.txt | 3 ++-
git-clone.sh | 12 ++++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
applies-to: 9cc3928769f8f4e3597fa446321112c0568514df
a0b45ee2b1362d664cca2d81f2915ed3b903b252
diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index cbd83f3..fefd298 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -25,7 +25,8 @@ This is to help the typical workflow of
remote `master` branch. Every time `git pull` without argument
is run, the progress on the remote `master` branch is tracked by
copying it into the local `origin` branch, and merged into the
-branch you are currently working on.
+branch you are currently working on. Remote branches other than
+`master` are also added there to be tracked.
OPTIONS
diff --git a/git-clone.sh b/git-clone.sh
index 1adf604..4fdd652 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -202,8 +202,16 @@ then
mkdir -p .git/remotes &&
echo >.git/remotes/origin \
"URL: $repo
-Pull: $head_points_at:origin"
- cp ".git/refs/heads/$head_points_at" .git/refs/heads/origin
+Pull: $head_points_at:origin" &&
+ cp ".git/refs/heads/$head_points_at" .git/refs/heads/origin &&
+ find .git/refs/heads -type f -print |
+ while read ref
+ do
+ head=`expr "$ref" : '.git/refs/heads/\(.*\)'` &&
+ test "$head_points_at" = "$head" ||
+ test "origin" = "$head" ||
+ echo "Pull: ${head}:${head}"
+ done >>.git/remotes/origin
esac
case "$no_checkout" in
---
0.99.9.GIT
prev parent reply other threads:[~2005-11-06 9:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-04 0:23 Trying to Update All Heads of a Repository Jon Loeliger
2005-11-04 1:04 ` Linus Torvalds
2005-11-04 2:42 ` Junio C Hamano
2005-11-04 23:47 ` Daniel Barkalow
2005-11-05 2:07 ` Junio C Hamano
2005-11-06 9:23 ` Junio C Hamano [this message]
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=7v1x1u1652.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=barkalow@iabervon.org \
--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).