Skip to contentSkip to conversation

gitweb: Use -M option while using format-patch

RFC PATCH In review Pavan Kumar Sunkara 4 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 gitweb: Use -M option while using format-patch

Add option '-M' to use with format-patch whcih detects renames in the commit.

---

 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
gitweb/gitweb.perl +1 -1
index c356e95..0184de5 100755
@@ -6117,7 +6117,7 @@ sub git_commitdiff {
                        }
                        push @commit_spec, '--root', $hash;
                }
-               open $fd, "-|", git_cmd(), "format-patch", '--encoding=utf8',
+               open $fd, "-|", git_cmd(), "format-patch", '-M', '--encoding=utf8',
                        '--stdout', @commit_spec
                        or die_error(500, "Open git-format-patch failed");
        } else {
Signature · 1 line
1.7.0.4
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Pavan Kumar Sunkara

Add option '-M' to use with format-patch whcih detects renames in the commit.

I think git-specific format is no big issue; even if you are applying the patch with plain patch(1) instead, you might very well prefer to be informed of the rename and take appropriate precautions (like mv'ing before applying to avoid unsolvable rejects).

Quoted 4 lines

---

 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

But please do something about the whitespace damage in the patches you send, thanks!

Signature · 3 lines
				Petr "Pasky" Baudis
When I feel like exercising, I just lie down until the feeling
goes away.  -- xed_over
Acked-by on v1 1/1
#2 lore raw
In reply to Pavan Kumar Sunkara

CC-ed Guiseppe Bilotta, author of 'patch' and 'patches' views (you can find this information using "git blame" or "git log --grep").

Quoted 2 lines · Pavan Kumar Sunkara

Add option '-M' to use with format-patch whcih detects renames in the commit.

Subject: [PATCH RFC GSoC] gitweb: Use @diff_opts while using format-patch

Make git-format-patch (used by 'patch' and 'patches' views) use the same rename detection options that git-diff and git-diff-tree (used by 'commitdiff', 'blobdiff', etc.) use.

Note that I am not sure if it is really a good change, as it might create patches that (currently) can be applied only with git.

Quoted 12 lines

---

  gitweb/gitweb.perl |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
gitweb/gitweb.perl +0 -0
index c356e95..0184de5 100755

gitweb/gitweb.perl sub git_commitdiff { · line 6120

Quoted 5 lines
gitweb/gitweb.perl +1 -1
@@ -6117,7 +6117,7 @@ sub git_commitdiff {
                         }
                         push @commit_spec, '--root', $hash;
                 }
-               open $fd, "-|", git_cmd(), "format-patch", '--encoding=utf8',
+               open $fd, "-|", git_cmd(), "format-patch", '-M', '--encoding=utf8',

+ open $fd, "-|", git_cmd(), "format-patch", @diff_opts, '--encoding=utf8',

or

- open $fd, "-|", git_cmd(), "format-patch", '--encoding=utf8',
- '--stdout', @commit_spec
+ open $fd, "-|", git_cmd(), "format-patch", @diff_opts,
+ '--encoding=utf8', '--stdout', @commit_spec

This patsh is both line-wrapped and whitespace-damaged (tabs replaced by spacess)

gitweb/gitweb.perl sub git_commitdiff { · line 6123

Quoted 4 lines
gitweb/gitweb.perl +0 -0
                         '--stdout', @commit_spec
                         or die_error(500, "Open git-format-patch failed");
         } else {

-- >8 --
Subject: [PATCH RFC GSoC] gitweb: Use @diff_opts while using format-patch

Make git-format-patch (used by 'patch' and 'patches' views) use the same rename detection options that git-diff and git-diff-tree (used by 'commitdiff', 'blobdiff', etc.) use.

---
 gitweb/gitweb.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
gitweb/gitweb.perl +2 -2
index 225f404..d983ce5 100755
@@ -6295,8 +6295,8 @@ sub git_commitdiff {
 			}
 			push @commit_spec, '--root', $hash;
 		}
-		open $fd, "-|", git_cmd(), "format-patch", '--encoding=utf8',
-			'--stdout', @commit_spec
+		open $fd, "-|", git_cmd(), "format-patch", @diff_opts,
+			'--encoding=utf8', '--stdout', @commit_spec
 			or die_error(500, "Open git-format-patch failed");
 	} else {
 		die_error(400, "Unknown commitdiff format");
#3 lore raw
Quoted 5 lines · Jakub Narebski

CC-ed Guiseppe Bilotta, author of 'patch' and 'patches' views (you can find this information using "git blame" or "git log --grep").

On Mon, 10 May 2010, Pavan Kumar Sunkara wrote:

Quoted 8 lines
Quoted 2 lines

Add option '-M' to use with format-patch whcih detects renames in the commit.

 Subject: [PATCH RFC GSoC] gitweb: Use @diff_opts while using format-patch

 Make git-format-patch (used by 'patch' and 'patches' views) use the same rename detection options that git-diff and git-diff-tree (used by 'commitdiff', 'blobdiff', etc.) use.

Excellent idea.

Quoted 2 lines

Note that I am not sure if it is really a good change, as it might create patches that (currently) can be applied only with git.

I think we can live with that. If we get strong complains about this, we can always introduce support for extra options to cancel the rename detection. (Also, the upcoming GNU patch release seems to support the git diff format, including copies and renames.)

Quoted 9 lines

-- >8 --
Subject: [PATCH RFC GSoC] gitweb: Use @diff_opts while using format-patch

Make git-format-patch (used by 'patch' and 'patches' views) use the same rename detection options that git-diff and git-diff-tree (used by 'commitdiff', 'blobdiff', etc.) use.

Quoted 20 lines

---
 gitweb/gitweb.perl |    4 ++--

 1 files changed, 2 insertions(+), 2 deletions(-)
gitweb/gitweb.perl +2 -2
index 225f404..d983ce5 100755
@@ -6295,8 +6295,8 @@ sub git_commitdiff {
                        }
                        push @commit_spec, '--root', $hash;
                }
-               open $fd, "-|", git_cmd(), "format-patch", '--encoding=utf8',
-                       '--stdout', @commit_spec
+               open $fd, "-|", git_cmd(), "format-patch", @diff_opts,
+                       '--encoding=utf8', '--stdout', @commit_spec
                        or die_error(500, "Open git-format-patch failed");
        } else {
                die_error(400, "Unknown commitdiff format");
Signature · 1 line
Giuseppe "Oblomov" Bilotta