{"thread":{"id":"6918","subject":"RFC: script to add another remote","startedAt":"2007-02-22T22:16:35Z","lastAt":"2007-02-23T08:43:26Z","messageCount":6,"participants":["Pavel Roskin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"35278","messageId":"1172182595.20817.26.camel@dv","threadId":"6918","inReplyTo":null,"subject":"RFC: script to add another remote","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2007-02-22T22:16:35Z","receivedAt":"2007-02-22T22:16:35Z","isPatch":false,"sender":{"key":"proski@gnu.org","avatar":null},"body":"Hello!\n\nI'm trying to find the best way to add a new remote to an existing\nrepository, create a local branch for it and make it easy to switch to\nthat branch and back and to update all branches.\n\nThis is important because some Linux developers want to publish their\nbranches without having to serve the whole Linux repository, which is\nabout 175Mb even if packed with repack.usedeltabaseoffset=true.\n\nI have written a simple script \"git-clone-more\" to help users who want\nto track more than one remote:\n\n\n#!/bin/sh\nset -e\nif test $# -lt 2 || test $# -gt 4; then\n\techo \"Usage: git-clone-more URL REMOTE [BRANCH [REMBRANCH]]\" >&2\n\texit 1\nfi\nURL=$1\nREMOTE=$2\nBRANCH=${3-$REMOTE}\nREMBRANCH=${4-master}\ngit-remote add \"$REMOTE\" \"$URL\"\ngit-fetch \"$REMOTE\"\ngit-config branch.\"$BRANCH\".remote \"$REMOTE\"\ngit-config branch.\"$BRANCH\".merge refs/heads/\"$REMBRANCH\"\ngit-checkout -b \"$BRANCH\" remotes/\"$REMOTE\"/\"$REMBRANCH\"\n\n\nIf there is any easier way to do the same thing?  Maybe we could extend\none of the git commands or make the above script another git command?\n\nIt's interesting that git-clone-more can be used instead of git-clone.\nI can use it e.g. to check out git in an empty directory:\n\ngit-init\ngit-clone-more git://www.kernel.org/pub/scm/git/git.git git\n\n-- \nRegards,\nPavel Roskin\n"},{"id":"35279","messageId":"7v8xepde5g.fsf@assigned-by-dhcp.cox.net","threadId":"6918","inReplyTo":"1172182595.20817.26.camel@dv","subject":"Re: RFC: script to add another remote","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-22T22:24:27Z","receivedAt":"2007-02-22T22:24:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pavel Roskin <proski@gnu.org> writes:\n\n> It's interesting that git-clone-more can be used instead of git-clone.\n> I can use it e.g. to check out git in an empty directory:\n>\n> git-init\n> git-clone-more git://www.kernel.org/pub/scm/git/git.git git\n\nIsn't that what \"git remote\" is about?\n"},{"id":"35303","messageId":"1172218468.20390.15.camel@dv","threadId":"6918","inReplyTo":"7v8xepde5g.fsf@assigned-by-dhcp.cox.net","subject":"Re: RFC: script to add another remote","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2007-02-23T08:14:28Z","receivedAt":"2007-02-23T08:14:28Z","isPatch":false,"sender":{"key":"proski@gnu.org","avatar":null},"body":"On Thu, 2007-02-22 at 14:24 -0800, Junio C Hamano wrote:\n> Pavel Roskin <proski@gnu.org> writes:\n> \n> > It's interesting that git-clone-more can be used instead of git-clone.\n> > I can use it e.g. to check out git in an empty directory:\n> >\n> > git-init\n> > git-clone-more git://www.kernel.org/pub/scm/git/git.git git\n> \n> Isn't that what \"git remote\" is about?\n\nI don't understand your question.  \"git remote\" doesn't provide this\nfunctionality by itself.  \"git remote\" is used by git-clone-more.  I\nwish I were missing the obvious, but just mentioning \"git remote\" to me\ndoesn't seem to help.\n\nI see that the manual for \"git-remote\" includes an example repeating\nsome parts of git-clone-more.  That's another evidence that the\nfunctionality provided by git-clone-more is needed.\n\nIt looks like git-clone should be extended to support cloning of a\nrepository on top of the existing one.\n\n-- \nRegards,\nPavel Roskin\n"},{"id":"35304","messageId":"7vbqjl9td1.fsf@assigned-by-dhcp.cox.net","threadId":"6918","inReplyTo":"1172218468.20390.15.camel@dv","subject":"Re: RFC: script to add another remote","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-23T08:21:46Z","receivedAt":"2007-02-23T08:21:46Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pavel Roskin <proski@gnu.org> writes:\n\n> It looks like git-clone should be extended to support cloning of a\n> repository on top of the existing one.\n\nActually git-remote was done during a previous discussion on the\nsame subject, with a goal to make it possible to rewrite\ngit-clone (after giving the \"where is the HEAD\" logic to\ngit-remote, perhaps) in terms of git-init and git-remote.\n\nSo probably the next step would be to refactor some logic and\nfunctionality out of git-clone, move them to git-remote, and\nreimplement git-clone in terms of git-remote.  Implementation of\n\"--more\" option would become much simpler (or, almost free)\nafter that is done.\n"},{"id":"35305","messageId":"1172219072.20390.17.camel@dv","threadId":"6918","inReplyTo":"7vbqjl9td1.fsf@assigned-by-dhcp.cox.net","subject":"Re: RFC: script to add another remote","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2007-02-23T08:24:32Z","receivedAt":"2007-02-23T08:24:32Z","isPatch":false,"sender":{"key":"proski@gnu.org","avatar":null},"body":"On Fri, 2007-02-23 at 00:21 -0800, Junio C Hamano wrote:\n> Pavel Roskin <proski@gnu.org> writes:\n> \n> > It looks like git-clone should be extended to support cloning of a\n> > repository on top of the existing one.\n> \n> Actually git-remote was done during a previous discussion on the\n> same subject, with a goal to make it possible to rewrite\n> git-clone (after giving the \"where is the HEAD\" logic to\n> git-remote, perhaps) in terms of git-init and git-remote.\n> \n> So probably the next step would be to refactor some logic and\n> functionality out of git-clone, move them to git-remote, and\n> reimplement git-clone in terms of git-remote.  Implementation of\n> \"--more\" option would become much simpler (or, almost free)\n> after that is done.\n\nOh, I see.  Thanks for the explanation.\n\n-- \nRegards,\nPavel Roskin\n"},{"id":"35308","messageId":"7vr6sh8dsh.fsf@assigned-by-dhcp.cox.net","threadId":"6918","inReplyTo":"1172219072.20390.17.camel@dv","subject":"Re: RFC: script to add another remote","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-23T08:43:26Z","receivedAt":"2007-02-23T08:43:26Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pavel Roskin <proski@gnu.org> writes:\n\n>> So probably the next step would be to refactor some logic and\n>> functionality out of git-clone, move them to git-remote, and\n>> reimplement git-clone in terms of git-remote.  Implementation of\n>> \"--more\" option would become much simpler (or, almost free)\n>> after that is done.\n>\n> Oh, I see.  Thanks for the explanation.\n\nSorry for being incomplete --- obviously you cannot reimplement\nclone with init and remote alone.  You need 'fetch' ;-).\n"}]}