git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Show remote branches on gitweb

From
Jakub Narebski <jnareb@gmail.com>
Date
Nov 27, 2006, 19:26 UTC
Message-ID
<ekfe15$a48$1@sea.gmane.org>
In-Reply-To
<loom.20061127T200958-750@post.gmane.org>
Pazu wrote:
Show 42 quoted lines
> Jakub Narebski <jnareb <at> gmail.com> writes:
> 
>> > 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.
> 
> 
> --- a/gitweb.cgi      2006-11-23 11:02:34.000000000 -0200
> +++ b/gitweb.cgi      2006-11-27 10:09:56.000000000 -0200
> @@ -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.
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.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Previous: PazuNext: Pazu
Message 11 of 12 in “Show remote branches on gitweb”
  1. PazuNov 24, 2006
  2. Jakub NarebskiNov 24, 2006
  3. Jakub NarebskiNov 24, 2006
  4. Petr BaudisNov 24, 2006
  5. Jakub NarebskiNov 25, 2006
  6. Junio C HamanoNov 25, 2006
  7. Petr BaudisNov 25, 2006
  8. Junio C HamanoNov 25, 2006
  9. Jakub NarebskiNov 28, 2006
  10. PazuNov 27, 2006
  11. Jakub NarebskiNov 27, 2006
  12. PazuNov 28, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.