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

[PATCH] Use describe to come up with the closest tag.

From
Junio C Hamano <junkio@cox.net>
Date
Feb 9, 2006, 00:01 UTC
Message-ID
<7vmzh1mmd4.fsf_-_@assigned-by-dhcp.cox.net>
In-Reply-To
<7vu0b9mmij.fsf@assigned-by-dhcp.cox.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 * This gives saner output than what is currently there.  It
   does not have direct relation to the diff-tree --cc patch,
   but over there I already use describe so this patch is to
   make things consistent.
 gitweb.cgi |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)
3fb28888448edc8b2d4aeab55bc13d78746e5a45
diff --git a/gitweb.cgi b/gitweb.cgi
index c1bb624..3c43695 100755
--- a/gitweb.cgi
+++ b/gitweb.cgi
@@ -2051,20 +2051,11 @@ sub git_commitdiff_plain {
 	close $fd or die_error(undef, "Reading diff-tree failed.");
 
 	# try to figure out the next tag after this commit
-	my $tagname;
 	my $refs = read_info_ref("tags");
-	open $fd, "-|", "$gitbin/git-rev-list HEAD";
-	chomp (my (@commits) = <$fd>);
+	open $fd, "-|", "$gitbin/git-describe $hash";
+	my ($tagname) = <$fd>;
+	chomp($tagname);
 	close $fd;
-	foreach my $commit (@commits) {
-		if (defined $refs->{$commit}) {
-			$tagname = $refs->{$commit}
-		}
-		if ($commit eq $hash) {
-			last;
-		}
-	}
-
 	print $cgi->header(-type => "text/plain", -charset => 'utf-8', '-content-disposition' => "inline; filename=\"git-$hash.patch\"");
 	my %co = git_read_commit($hash);
 	my %ad = date_str($co{'author_epoch'}, $co{'author_tz'});
-- 
1.1.6.gbb042
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 27 in “gitweb using "--cc"?”
  1. Linus TorvaldsFeb 8, 2006
  2. Junio C HamanoFeb 8, 2006
  3. Use describe to come up with the closest tag.Junio C Hamano, Feb 9, 2006
  4. Allow using --cc when showing a merge.Junio C Hamano, Feb 9, 2006
  5. Brian GerstFeb 9, 2006
  6. Linus TorvaldsFeb 9, 2006
  7. Junio C HamanoFeb 9, 2006
  8. Linus TorvaldsFeb 9, 2006
  9. Linus TorvaldsFeb 9, 2006
  10. Linus TorvaldsFeb 9, 2006
  11. Junio C HamanoFeb 9, 2006
  12. Linus TorvaldsFeb 9, 2006
  13. Linus TorvaldsFeb 9, 2006
  14. Junio C HamanoFeb 9, 2006
  15. Junio C HamanoFeb 9, 2006
  16. Junio C HamanoFeb 9, 2006
  17. Junio C HamanoFeb 9, 2006
  18. Junio C HamanoFeb 9, 2006
  19. Marco CostalbaFeb 11, 2006
  20. Junio C HamanoFeb 11, 2006
  21. Junio C HamanoFeb 11, 2006
  22. Junio C HamanoFeb 9, 2006
  23. Linus TorvaldsFeb 9, 2006
  24. Junio C HamanoFeb 9, 2006
  25. combine-diff: Record diff status a bit more faithfullyJunio C Hamano, Feb 10, 2006
  26. combine-diff: move formatting logic to show_combined_diff()Junio C Hamano, Feb 9, 2006
  27. Kay SieversFeb 9, 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.