threads / patch / 10621

patchAdd support for # in URLs in git-remote (was: Re: [PATCH] New script: git-changelog.perl - revised)

Subject: [PATCH] Add support for # in URLs in git-remote (was: Re: [PATCH] New script: git-changelog.perl - revised)

## tl;dr

3 messages between Nov 3, 2007 and Nov 13, 2007. Diffs are folded; open one to read it.

replies: 2people: 3as markdown or json

Ronald Landheer-Cieslak· Nov 3, 2007, 15:26 UTC · lore

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@gmx.de> wrote:
Show 17 quoted lines
> On Sat, 3 Nov 2007, Ronald Landheer-Cieslak wrote:
> > On Nov 3, 2007 4:36 AM, Andreas Ericsson <ae@op5.se> 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@landheer-cieslak.com>
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);
Johannes Schindelin· Nov 3, 2007, 15:27 UTC · re: Ronald Landheer-Cieslak · lore

Re: [PATCH] Add support for # in URLs in git-remote (was: Re: [PATCH] New script: git-changelog.perl - revised)

Hi,
On Sat, 3 Nov 2007, Ronald Landheer-Cieslak wrote:
> The attached patch adds support for # signs in URLs passed to git-remote 
> add.
NACK!

Please be polite enough to read up on the _many_ emails on this list about this very subject.

Not doing so just _wastes_ our time.

Sorry for being so harsh, but this very subject easily cost me 20 hours in total(!) in the last few weeks.

Ciao, Dscho

Josh Triplett· Nov 13, 2007, 23:56 UTC · re: Johannes Schindelin · lore

Re: [PATCH] Add support for # in URLs in git-remote (was: Re: [PATCH] New script: git-changelog.perl - revised)

Johannes Schindelin wrote:
Show 13 quoted lines
> On Sat, 3 Nov 2007, Ronald Landheer-Cieslak wrote:
>> The attached patch adds support for # signs in URLs passed to git-remote 
>> add.
> 
> NACK!
> 
> Please be polite enough to read up on the _many_ emails on this list about 
> this very subject.
> 
> Not doing so just _wastes_ our time.
> 
> Sorry for being so harsh, but this very subject easily cost me 20 hours in 
> total(!) in the last few weeks.

Perhaps this should go in the Git FAQ at http://git.or.cz/gitwiki/GitFaq . Does your message with Message-ID <Pine.LNX.4.64.0710162228560.25221@racer.site>, subject "Re: remote#branch", accurately describe the full problem with using #, namely that refs can contain #?

Any other problems besides not having the ability to reference more than one branch with this syntax?

- Josh Triplett

← back to recent threads