{"thread":{"id":"3020","subject":"gitweb sometimes shows branch heads sometimes doesn't","startedAt":"2006-01-09T09:35:09Z","lastAt":"2006-01-09T09:35:09Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"14353","messageId":"7v1wzhrbg2.fsf@assigned-by-dhcp.cox.net","threadId":"3020","inReplyTo":null,"subject":"gitweb sometimes shows branch heads sometimes doesn't","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-09T09:35:09Z","receivedAt":"2006-01-09T09:35:09Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Has anybody wondered why some repositories at kernel.org have\nyellowish (#ffffaa) <master> at the latest commit in the\nshortlog on the summary page, and some do not have it at all\nor have it at a wrong place, i.e. not at the top?\n\nhttp://www.kernel.org/git/?p=git/git.git;a=summary\nhttp://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=summary\n\nThis is because gitweb looks at info/refs as a shortcut to find\nout which commits branch heads and tags are pointing at, in\norder to place these markers.  The repositories that do not have\nthe marker at the right place in gitweb have this file out-of-date.\n\nIn fact, most of the repositories at kernel.org seem to either\nnot have info/refs at all, or have them out-of-date.\n\nThis file is updated when git-update-server-info is run on the\nrepository, along with another file objects/info/packs.  It also\nis used by dumb http transfer, so the corollary is that you may\nhave trouble fetching via http from any repository that does not\nshow the branch head marker at the latest commit in gitweb.\n\nAttached is a patch to gitweb that I do _not_ really want Kay to\napply, because I think helping people to acquire a good habit to\nhelp others is a good thing, and I would like to encourage\nrepository owners to do this, so update-server-info is run every\ntime the repository is pushed into:\n\n\tmkdir -p hooks\n        cat >hooks/post-update <<\\EOF\n        #!/bin/sh\n        exec git-update-server-info\n\tEOF\n\tchmod +x hooks/post-update\n\nThe first 5 lines are unneeded for people who initialized the\nrepository with recent git (later than v0.99.3-g8d5a on Aug 2nd,\n2005), because they are likely to have the necessary file from\nthe templates.\n\nHOWEVER.\n\nIf enough repository owners forget to do so, and I suspect some\nof them deliberately forget to do so in order to discourage use\nof dumb http transfers -- you know whom I mean ;-), at least\ngitweb can be helped with this patch.\n\n-- >8 --\n[PATCH] Do not rely on info/refs\n\nI personally consider this change is backwards, but many\nrepositories at kernel.org have obsolete info/refs (i.e. the\nowners do not run git-update-server-info in them), so the\ninformation kept there is unfortunately unreliable.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n gitweb.cgi |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\nf22fb181cb315bfa14261d81fcaba25154224384\ndiff --git a/gitweb.cgi b/gitweb.cgi\nindex 1814f7f..a97859e 100755\n--- a/gitweb.cgi\n+++ b/gitweb.cgi\n@@ -914,7 +914,9 @@ sub read_info_ref {\n \tmy %refs;\n \t# 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c\trefs/tags/v2.6.11\n \t# c39ae07f393806ccf406ef966e9a15afc43cc36a\trefs/tags/v2.6.11^{}\n-\topen my $fd, \"$projectroot/$project/info/refs\" or return;\n+\n+\topen my $fd, \"-|\", \"$gitbin/git\", \"ls-remote\", \"$projectroot/$project\"\n+\t\tor return;\n \twhile (my $line = <$fd>) {\n \t\tchomp($line);\n \t\tif ($line =~ m/^([0-9a-fA-F]{40})\\t.*$type\\/([^\\^]+)/) {\n-- \n1.1.0\n"}]}