Skip to contentSkip to conversation

gitweb: Fix file name quoting in simplified out patch detection for --cc output

PATCH In review Jakub Narebski 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gitweb: Fix file name quoting in simplified out patch detection for --cc output

For the --cc (compressed combined) diff output there can be patches which are simple and got simplified out, so there is no patch corresponding to raw output line.

Fix detection of of such simplified out patches: file name in git diff header for --cc diff can be quoted; unquote it.

---
This patch depends _textually_ on the just send
"gitweb: Fix and simplify "split patch" detection"
patch, although it is _conceptually_ independent.

The commit message could be better...

 gitweb/gitweb.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
gitweb/gitweb.perl +2 -2
index 8c1e02c..5d424e5 100755
@@ -3140,8 +3140,8 @@ sub git_patchset_body {
 			# compact combined diff output can have some patches skipped
 			# find which patch (using pathname of result) we are at now
 			my $to_name;
-			if ($patch_line =~ m!^diff --cc "?(.*)"?$!) {
-				$to_name = $1;
+			if ($patch_line =~ m!^diff --cc ("?.*"?)$!) {
+				$to_name = unquote($1);
 			}
 
 			do {
Signature · 1 line
1.5.2.5
#1 lore raw

gitweb/gitweb.perl sub git_patchset_body { · line 3145

Quoted 13 lines · Jakub Narebski
gitweb/gitweb.perl +2 -2
index 8c1e02c..5d424e5 100755
@@ -3140,8 +3140,8 @@ sub git_patchset_body {
 			# compact combined diff output can have some patches skipped
 			# find which patch (using pathname of result) we are at now
 			my $to_name;
-			if ($patch_line =~ m!^diff --cc "?(.*)"?$!) {
-				$to_name = $1;
+			if ($patch_line =~ m!^diff --cc ("?.*"?)$!) {
+				$to_name = unquote($1);
 			}

This patch obviously makes sense, but I wonder why you use the form m!foobar! here, instead of far simpler to read /foobar/ form?

#2 lore raw
Quoted 11 lines · Junio C Hamano
Quoted 9 lines · Jakub Narebski
gitweb/gitweb.perl +0 -1
index 8c1e02c..5d424e5 100755
@@ -3140,8 +3140,8 @@ sub git_patchset_body {
 			# compact combined diff output can have some patches skipped
 			# find which patch (using pathname of result) we are at now
 			my $to_name;
-			if ($patch_line =~ m!^diff --cc "?(.*)"?$!) {
Quoted 8 lines

gitweb/gitweb.perl sub git_patchset_body { · line 3145

Quoted 4 lines
gitweb/gitweb.perl +2 -1
-				$to_name = $1;
+			if ($patch_line =~ m!^diff --cc ("?.*"?)$!) {
+				$to_name = unquote($1);
 			}

This patch obviously makes sense, but I wonder why you use the form m!foobar! here, instead of far simpler to read /foobar/ form?

Consistency (kind of). For the ordinary diff output I use m!regexp! instead of simpler /regexp/ to avoid 'leaning toothpicks' syndrome:

m!^diff --git "?a/.*"? "?b/.*"?!

But as it is now not near, then I guess /regexp/ would be better...

Signature · 2 lines
Jakub Narebski
Poland