The attached patch adds support for # signs in URLs passed to git-remote add. The suggestion that, in stead of putting a # in the URL I should set up a new public repository with just the topic branch in it triggers a reaction of dismay in me: to me, Git is a fast and resource-sparing SCM and setting up a second repository just for publishing a branch seems more than awkward to me - it's a waste of space and a waste of (my) time. So I've taken a look at the git-remote code and added a small patch to support # signs in git-remote add URLs 1 files changed, 6 insertions(+), 1 deletions(-) This makes git-remote add behave as if whatever comes after the # in the URL was passed as a -t option. Other options are still allowed, so with # in the URL, nothing else changes HTH rlc On Nov 3, 2007 9:58 AM, Johannes Schindelin <Johannes.Schindelin@xxxxxx> wrote: > On Sat, 3 Nov 2007, Ronald Landheer-Cieslak wrote: > > On Nov 3, 2007 4:36 AM, Andreas Ericsson <ae@xxxxxx> wrote: > > > Ronald Landheer-Cieslak wrote: > > > > > > > > This is also available through git at > > > > git://vlinder.landheer-cieslak.com/git/git.git#topic/git-log-changelog > > > > > > > > > > This mode of specifying a repository + branch was just thoroughly shot > > > down in a list discussion, and git certainly doesn't grok it. I'd be a > > > happier fella if you didn't use it. > > > > > Is there a canonical way to specify both the location and the branch > > in one shot, then? > > Yes. Create a repository containing only that branch, as "master", and > point people to that repository. -- Ronald Landheer-Cieslak Software Architect http://www.landheer-cieslak.com/ New White Paper: "Three Good Reasons to Plan Ahead"
commit 9aa00ba7096d050bb62e48334a400270afd65735 Author: Ronald Landheer-Cieslak <ronald@xxxxxxxxxxxxxxxxxxxx> Date: Sat Nov 3 10:47:00 2007 -0400 Support # in URLs and interpret them as tracking branches diff --git a/git-remote.perl b/git-remote.perl index d13e4c1..6b26523 100755 --- a/git-remote.perl +++ b/git-remote.perl @@ -271,7 +271,12 @@ sub show_remote { } sub add_remote { - my ($name, $url, $opts) = @_; + my ($name, $url_, $opts) = @_; + + my ($url, $branch) = split(/#/, $url_); + $opts->{'track'} ||= []; + push @{$opts->{'track'}}, $branch if ($branch); + if (exists $remote->{$name}) { print STDERR "remote $name already exists.\n"; exit(1);