Skip to contentSkip to conversation

Show remote branches on gitweb

DISCUSSION Pazu 4 participants 12 messages Aug 11, 2016

lore
Share & tools
lore

Pazu

author
#0 lore raw

Is there any way to do it? I'm using git-svn to track a remote subversion repository, and it would be very nice to browse the history for a remote branch for which I didn't start a local branch yet.

-- Pazu

#1 lore raw
Quoted 3 lines · Pazu

Is there any way to do it? I'm using git-svn to track a remote subversion repository, and it would be very nice to browse the history for a remote branch for which I didn't start a local branch yet.

Planned, not implemented yet.

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#2 lore raw
Quoted 7 lines · Jakub Narebski
Quoted 3 lines · Pazu

Is there any way to do it? I'm using git-svn to track a remote subversion repository, and it would be very nice to browse the history for a remote branch for which I didn't start a local branch yet.

Planned, not implemented yet.

The problem is that to implement it _well_ we have to get remotes, both $GIT_DIR/remotes and config remote.xxx, info. And the latter (config remotes info) needs config parsing, something we lack.

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#3 lore raw
Quoted 8 lines · Jakub Narebski
Quoted 6 lines · Jakub Narebski
Quoted 3 lines · Pazu

Is there any way to do it? I'm using git-svn to track a remote subversion repository, and it would be very nice to browse the history for a remote branch for which I didn't start a local branch yet.

Quoted 5 lines
Quoted 1 line

Planned, not implemented yet.

The problem is that to implement it _well_ we have to get remotes, both $GIT_DIR/remotes and config remote.xxx, info. And the latter (config remotes info) needs config parsing, something we lack.

Does that mean we _can_ parse $GIT_DIR/remotes? ;-)

Signature · 4 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
The meaning of Stonehenge in Traflamadorian, when viewed from above, is:
"Replacement part being rushed with all possible speed."
#4 lore raw
Quoted 5 lines · Petr Baudis
Quoted 3 lines

The problem is that to implement it _well_ we have to get remotes, both $GIT_DIR/remotes and config remote.xxx, info. And the latter (config remotes info) needs config parsing, something we lack.

Does that mean we _can_ parse $GIT_DIR/remotes? ;-)

Surely you should be able to. You are working in Perl and the remotes and config are trivially parsable text files.

#5 lore raw
Quoted 10 lines · Junio C Hamano
Quoted 5 lines · Petr Baudis
Quoted 3 lines

The problem is that to implement it _well_ we have to get remotes, both $GIT_DIR/remotes and config remote.xxx, info. And the latter (config remotes info) needs config parsing, something we lack.

Does that mean we _can_ parse $GIT_DIR/remotes? ;-)

Surely you should be able to. You are working in Perl and the remotes and config are trivially parsable text files.

But so is the configuration file, unless I'm missing something...?

Signature · 4 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
The meaning of Stonehenge in Traflamadorian, when viewed from above, is:
"Replacement part being rushed with all possible speed."
#6 lore raw
Quoted 6 lines · Petr Baudis
Quoted 4 lines
Quoted 1 line

Does that mean we _can_ parse $GIT_DIR/remotes? ;-)

Surely you should be able to. You are working in Perl and the remotes and config are trivially parsable text files.

But so is the configuration file, unless I'm missing something...?

I do not think you are missing anything. I said that remotes and config are simple trivially parsable text files and Perl should be a pleasant tool to read them with.

So yes, we _can_ parse them, and we _can_ parse configuration file.

Unless I'm missing something...?

#7 lore raw
In reply to Petr Baudis
Quoted 9 lines · Petr Baudis
Quoted 8 lines · Jakub Narebski
Quoted 6 lines · Jakub Narebski
Quoted 3 lines · Pazu

Is there any way to do it? I'm using git-svn to track a remote subversion repository, and it would be very nice to browse the history for a remote branch for which I didn't start a local branch yet.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Planned, not implemented yet.

The problem is that to implement it _well_ we have to get remotes, both $GIT_DIR/remotes and config remote.xxx, info. And the latter (config remotes info) needs config parsing, something we lack.

Does that mean we _can_ parse $GIT_DIR/remotes? ;-)

No, but for implementing showing remote branches in gitweb _well_, but without frills'n'whistles, it is enough to know files in $GIT_DIR/remotes (Find::find those files), and don't need to parse remotes/ files.

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#8 lore raw
In reply to Jakub Narebski
Quoted 8 lines · Jakub Narebski
Quoted 6 lines · Jakub Narebski
Quoted 3 lines · Pazu

Is there any way to do it? I'm using git-svn to track a remote subversion repository, and it would be very nice to browse the history for a remote branch for which I didn't start a local branch yet.

Quoted 5 lines
Quoted 1 line

Planned, not implemented yet.

The problem is that to implement it _well_ we have to get remotes, both $GIT_DIR/remotes and config remote.xxx, info. And the latter (config remotes info) needs config parsing, something we lack.

We could simplify things, and assume that remote name is _never_ hierarchical, so that remote branches names are:
remotes/<remote>/<branch>
where <remote> does not contain '/'.

Additional problem is for "summary" view: should we limit number of heads per remote, should we sort heads inside remote, or should we also sort remotes, or should we sort remotes by time without grouping into repos?

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
author
#9 lore raw
In reply to Jakub Narebski
Quoted 6 lines · Jakub Narebski <jnareb <at> gmail.com> writes:
Quoted 4 lines

Is there any way to do it? I'm using git-svn to track a remote subversion repository, and it would be very nice to browse the history for a remote branch for which I didn't start a local branch yet.

Planned, not implemented yet.

Probably not a technically correct solution, but the following changes did the trick for me.

gitweb.cgi +2 -2
@@ -1428,8 +1431,7 @@
 
 	open my $fd, '-|', git_cmd(), 'for-each-ref',
 		($limit ? '--count='.($limit+1) : ()), '--sort=-committerdate',
-		'--format=%(objectname) %(refname) %(subject)%00%(committer)',
-		'refs/heads'
+		'--format=%(objectname) %(refname) %(subject)%00%(committer)'
 		or return;
 	while (my $line = <$fd>) {
 		my %ref_item;
@@ -1440,6 +1442,7 @@
 		my ($committer, $epoch, $tz) =
 			($committerinfo =~ /^(.*) ([0-9]+) (.*)$/);
 		$name =~ s!^refs/heads/!!;
+		$name =~ s!^refs/remotes/!!;
 
 		$ref_item{'name'}  = $name;
 		$ref_item{'id'}    = $hash;

I've just changed the git_get_heads_list function to let 'for-each-ref' return all top refs instead of just those in refs/heads, and added a line to remove 'refs/remotes/' from the remote branch names.

Again, probably not the right solution, but now I have remote branches listed under "heads", and that's all I really need.

-- Pazu

#10 lore raw
Quoted 36 lines · Pazu
Quoted 6 lines · Jakub Narebski <jnareb <at> gmail.com> writes:
Quoted 4 lines

Is there any way to do it? I'm using git-svn to track a remote subversion repository, and it would be very nice to browse the history for a remote branch for which I didn't start a local branch yet.

Planned, not implemented yet.

Probably not a technically correct solution, but the following changes did the trick for me.

gitweb.cgi 2006-11-27 10:09:56.000000000 -0200 renamed from gitweb.cgi 2006-11-23 11:02:34.000000000 -0200 +2 -2
@@ -1428,8 +1431,7 @@
 
      open my $fd, '-|', git_cmd(), 'for-each-ref',
              ($limit ? '--count='.($limit+1) : ()), '--sort=-committerdate',
-             '--format=%(objectname) %(refname) %(subject)%00%(committer)',
-             'refs/heads'
+             '--format=%(objectname) %(refname) %(subject)%00%(committer)'
              or return;
      while (my $line = <$fd>) {
              my %ref_item;
@@ -1440,6 +1442,7 @@
              my ($committer, $epoch, $tz) =
                      ($committerinfo =~ /^(.*) ([0-9]+) (.*)$/);
              $name =~ s!^refs/heads/!!;
+             $name =~ s!^refs/remotes/!!;
 
              $ref_item{'name'}  = $name;
              $ref_item{'id'}    = $hash;
Quoted 6 lines

I've just changed the git_get_heads_list function to let 'for-each-ref' return all top refs instead of just those in refs/heads, and added a line to remove 'refs/remotes/' from the remote branch names.

Again, probably not the right solution, but now I have remote branches listed under "heads", and that's all I really need.

What about tags (refs/tags/), which shouldn't be here?

Besides, it is quick'n'dirty solution; I'm not against having it as a patch in git mailing list archives, but I'd rather not have it there.

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
author
#11 lore raw
Quoted 1 line · Jakub Narebski <jnareb <at> gmail.com> writes:

What about tags (refs/tags/), which shouldn't be here?

Yeah, I just noticed that when I pointed gitweb to git's own repository (my project's repository currently has no tags). I've added a "next if $name =~ m!^refs/tags/!;" for now.

Quoted 2 lines

Besides, it is quick'n'dirty solution; I'm not against having it as a patch in git mailing list archives, but I'd rather not have it there.

Yes, it's quick and dirty. I didn't mean to have it published anywhere (and to anyone reading this from the archives: please don't use that ugly, quick, and really dirty patch).

I posted it as a way to say that I'm one more happy git user. While one could say that hacking gitweb to achieve happiness is cheating, the fact that I *could* do that easily, even when I barely understand perl, is a really big plus for me. You guys rock, really.

-- Pazu