git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* gitweb sometimes shows branch heads sometimes doesn't
@ 2006-01-09  9:35 Junio C Hamano
  0 siblings, 0 replies; only message in thread
From: Junio C Hamano @ 2006-01-09  9:35 UTC (permalink / raw)
  To: git

Has anybody wondered why some repositories at kernel.org have
yellowish (#ffffaa) <master> at the latest commit in the
shortlog on the summary page, and some do not have it at all
or have it at a wrong place, i.e. not at the top?

http://www.kernel.org/git/?p=git/git.git;a=summary
http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=summary

This is because gitweb looks at info/refs as a shortcut to find
out which commits branch heads and tags are pointing at, in
order to place these markers.  The repositories that do not have
the marker at the right place in gitweb have this file out-of-date.

In fact, most of the repositories at kernel.org seem to either
not have info/refs at all, or have them out-of-date.

This file is updated when git-update-server-info is run on the
repository, along with another file objects/info/packs.  It also
is used by dumb http transfer, so the corollary is that you may
have trouble fetching via http from any repository that does not
show the branch head marker at the latest commit in gitweb.

Attached is a patch to gitweb that I do _not_ really want Kay to
apply, because I think helping people to acquire a good habit to
help others is a good thing, and I would like to encourage
repository owners to do this, so update-server-info is run every
time the repository is pushed into:

	mkdir -p hooks
        cat >hooks/post-update <<\EOF
        #!/bin/sh
        exec git-update-server-info
	EOF
	chmod +x hooks/post-update

The first 5 lines are unneeded for people who initialized the
repository with recent git (later than v0.99.3-g8d5a on Aug 2nd,
2005), because they are likely to have the necessary file from
the templates.

HOWEVER.

If enough repository owners forget to do so, and I suspect some
of them deliberately forget to do so in order to discourage use
of dumb http transfers -- you know whom I mean ;-), at least
gitweb can be helped with this patch.

-- >8 --
[PATCH] Do not rely on info/refs

I personally consider this change is backwards, but many
repositories at kernel.org have obsolete info/refs (i.e. the
owners do not run git-update-server-info in them), so the
information kept there is unfortunately unreliable.

Signed-off-by: Junio C Hamano <junkio@cox.net>

---

 gitweb.cgi |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

f22fb181cb315bfa14261d81fcaba25154224384
diff --git a/gitweb.cgi b/gitweb.cgi
index 1814f7f..a97859e 100755
--- a/gitweb.cgi
+++ b/gitweb.cgi
@@ -914,7 +914,9 @@ sub read_info_ref {
 	my %refs;
 	# 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c	refs/tags/v2.6.11
 	# c39ae07f393806ccf406ef966e9a15afc43cc36a	refs/tags/v2.6.11^{}
-	open my $fd, "$projectroot/$project/info/refs" or return;
+
+	open my $fd, "-|", "$gitbin/git", "ls-remote", "$projectroot/$project"
+		or return;
 	while (my $line = <$fd>) {
 		chomp($line);
 		if ($line =~ m/^([0-9a-fA-F]{40})\t.*$type\/([^\^]+)/) {
-- 
1.1.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-01-09  9:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-09  9:35 gitweb sometimes shows branch heads sometimes doesn't Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).