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

[PATCH] gitweb: Do not show 'patch' link in 'commit' view for merges

From
Jakub Narebski <jnareb@gmail.com>
Date
Sep 30, 2009, 20:21 UTC
Message-ID
<20090930201953.22301.73887.stgit@localhost.localdomain>

Show 'patch' link in the 'commit' view only for commits which have exactly one parent, otherwise call to git-format-patch would fail for the hyperlinked 'patch' action.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Just noticed this issue, thanks indirectly to 
"Re: How can I download a git commit as a diff patch?"
thread.

This is conservative change: perhaps we could extend 'patch' view to work also for root commit...

 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 24b2193..fb045a1 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5328,7 +5328,7 @@ sub git_commit {
 			} @$parents ) .
 			')';
 	}
-	if (gitweb_check_feature('patches')) {
+	if (gitweb_check_feature('patches') && @$parents == 1) {
 		$formats_nav .= " | " .
 			$cgi->a({-href => href(action=>"patch", -replay=>1)},
 				"patch");
Next: Jeff King
Message 1 of 10 in “gitweb: Do not show 'patch' link in 'commit' view for merges”
  1. gitweb: Do not show 'patch' link in 'commit' view for mergesJakub Narebski, Sep 30, 2009
  2. Jeff KingOct 1, 2009
  3. Jakub NarebskiOct 1, 2009
  4. Jeff KingOct 1, 2009
  5. Jakub NarebskiOct 1, 2009
  6. gitweb: Do not show 'patch' link for merge commitsJakub Narebski, Oct 9, 2009
  7. Jakub NarebskiOct 9, 2009
  8. gitweb: Do not show 'patch' link for merge commitsJakub Narebski, Oct 9, 2009
  9. Jeff KingOct 9, 2009
  10. Junio C HamanoOct 10, 2009

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.