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

From: Jakub Narebski <[email-masked]>
Date: Wed, 30 Sep 2009 22:21:53 +0200

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 <[email-masked]>
---
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");