git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RFC: script to add another remote
@ 2007-02-22 22:16 Pavel Roskin
  2007-02-22 22:24 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Roskin @ 2007-02-22 22:16 UTC (permalink / raw)
  To: GIT list

Hello!

I'm trying to find the best way to add a new remote to an existing
repository, create a local branch for it and make it easy to switch to
that branch and back and to update all branches.

This is important because some Linux developers want to publish their
branches without having to serve the whole Linux repository, which is
about 175Mb even if packed with repack.usedeltabaseoffset=true.

I have written a simple script "git-clone-more" to help users who want
to track more than one remote:


#!/bin/sh
set -e
if test $# -lt 2 || test $# -gt 4; then
	echo "Usage: git-clone-more URL REMOTE [BRANCH [REMBRANCH]]" >&2
	exit 1
fi
URL=$1
REMOTE=$2
BRANCH=${3-$REMOTE}
REMBRANCH=${4-master}
git-remote add "$REMOTE" "$URL"
git-fetch "$REMOTE"
git-config branch."$BRANCH".remote "$REMOTE"
git-config branch."$BRANCH".merge refs/heads/"$REMBRANCH"
git-checkout -b "$BRANCH" remotes/"$REMOTE"/"$REMBRANCH"


If there is any easier way to do the same thing?  Maybe we could extend
one of the git commands or make the above script another git command?

It's interesting that git-clone-more can be used instead of git-clone.
I can use it e.g. to check out git in an empty directory:

git-init
git-clone-more git://www.kernel.org/pub/scm/git/git.git git

-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFC: script to add another remote
  2007-02-22 22:16 RFC: script to add another remote Pavel Roskin
@ 2007-02-22 22:24 ` Junio C Hamano
  2007-02-23  8:14   ` Pavel Roskin
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2007-02-22 22:24 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: GIT list

Pavel Roskin <proski@gnu.org> writes:

> It's interesting that git-clone-more can be used instead of git-clone.
> I can use it e.g. to check out git in an empty directory:
>
> git-init
> git-clone-more git://www.kernel.org/pub/scm/git/git.git git

Isn't that what "git remote" is about?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFC: script to add another remote
  2007-02-22 22:24 ` Junio C Hamano
@ 2007-02-23  8:14   ` Pavel Roskin
  2007-02-23  8:21     ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Roskin @ 2007-02-23  8:14 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT list

On Thu, 2007-02-22 at 14:24 -0800, Junio C Hamano wrote:
> Pavel Roskin <proski@gnu.org> writes:
> 
> > It's interesting that git-clone-more can be used instead of git-clone.
> > I can use it e.g. to check out git in an empty directory:
> >
> > git-init
> > git-clone-more git://www.kernel.org/pub/scm/git/git.git git
> 
> Isn't that what "git remote" is about?

I don't understand your question.  "git remote" doesn't provide this
functionality by itself.  "git remote" is used by git-clone-more.  I
wish I were missing the obvious, but just mentioning "git remote" to me
doesn't seem to help.

I see that the manual for "git-remote" includes an example repeating
some parts of git-clone-more.  That's another evidence that the
functionality provided by git-clone-more is needed.

It looks like git-clone should be extended to support cloning of a
repository on top of the existing one.

-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFC: script to add another remote
  2007-02-23  8:14   ` Pavel Roskin
@ 2007-02-23  8:21     ` Junio C Hamano
  2007-02-23  8:24       ` Pavel Roskin
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2007-02-23  8:21 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: GIT list

Pavel Roskin <proski@gnu.org> writes:

> It looks like git-clone should be extended to support cloning of a
> repository on top of the existing one.

Actually git-remote was done during a previous discussion on the
same subject, with a goal to make it possible to rewrite
git-clone (after giving the "where is the HEAD" logic to
git-remote, perhaps) in terms of git-init and git-remote.

So probably the next step would be to refactor some logic and
functionality out of git-clone, move them to git-remote, and
reimplement git-clone in terms of git-remote.  Implementation of
"--more" option would become much simpler (or, almost free)
after that is done.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFC: script to add another remote
  2007-02-23  8:21     ` Junio C Hamano
@ 2007-02-23  8:24       ` Pavel Roskin
  2007-02-23  8:43         ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Roskin @ 2007-02-23  8:24 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT list

On Fri, 2007-02-23 at 00:21 -0800, Junio C Hamano wrote:
> Pavel Roskin <proski@gnu.org> writes:
> 
> > It looks like git-clone should be extended to support cloning of a
> > repository on top of the existing one.
> 
> Actually git-remote was done during a previous discussion on the
> same subject, with a goal to make it possible to rewrite
> git-clone (after giving the "where is the HEAD" logic to
> git-remote, perhaps) in terms of git-init and git-remote.
> 
> So probably the next step would be to refactor some logic and
> functionality out of git-clone, move them to git-remote, and
> reimplement git-clone in terms of git-remote.  Implementation of
> "--more" option would become much simpler (or, almost free)
> after that is done.

Oh, I see.  Thanks for the explanation.

-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: RFC: script to add another remote
  2007-02-23  8:24       ` Pavel Roskin
@ 2007-02-23  8:43         ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2007-02-23  8:43 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: GIT list

Pavel Roskin <proski@gnu.org> writes:

>> So probably the next step would be to refactor some logic and
>> functionality out of git-clone, move them to git-remote, and
>> reimplement git-clone in terms of git-remote.  Implementation of
>> "--more" option would become much simpler (or, almost free)
>> after that is done.
>
> Oh, I see.  Thanks for the explanation.

Sorry for being incomplete --- obviously you cannot reimplement
clone with init and remote alone.  You need 'fetch' ;-).

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-02-23  8:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-22 22:16 RFC: script to add another remote Pavel Roskin
2007-02-22 22:24 ` Junio C Hamano
2007-02-23  8:14   ` Pavel Roskin
2007-02-23  8:21     ` Junio C Hamano
2007-02-23  8:24       ` Pavel Roskin
2007-02-23  8:43         ` Junio C Hamano

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).