Skip to contentSkip to conversation

scripts/checkpatch: roll diff tweaking into checkpatch itself

RFC PATCH In review Alex Bennée 5 participants 5 messages Jun 7, 2021 – Jun 8, 2021 Checkpatch

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 scripts/checkpatch: roll diff tweaking into checkpatch itself

Rather than relying on external tweaks lets just do it inside checkpatch's direct commitish handling which is QEMU specific code anyway.

---
 .gitlab-ci.d/static_checks.yml | 3 ---
 .patchew.yml                   | 3 ---
 scripts/checkpatch.pl          | 7 ++++++-
 3 files changed, 6 insertions(+), 7 deletions(-)
.gitlab-ci.d/static_checks.yml +0 -3
index 7e685c6a65..c5fa4fce26 100644
@@ -4,9 +4,6 @@ check-patch:
   needs:
     job: amd64-centos8-container
   script:
-    - git config --local diff.renamelimit 0
-    - git config --local diff.renames True
-    - git config --local diff.algorithm histogram
     - .gitlab-ci.d/check-patch.py
   variables:
     GIT_DEPTH: 1000
.patchew.yml +0 -3
index 2638b7f564..1b78262ce5 100644
@@ -138,9 +138,6 @@ testing:
       script: |
         #!/bin/bash
         git rev-parse base > /dev/null || exit 0
-        git config --local diff.renamelimit 0
-        git config --local diff.renames True
-        git config --local diff.algorithm histogram
         ./scripts/checkpatch.pl --mailback base..
     docker-mingw@fedora:
       enabled: true
scripts/checkpatch.pl +6 -1
index bbcd25ae05..cb8eff233e 100755
@@ -399,7 +399,12 @@ if ($chk_branch) {
 	my $num_patches = @patches;
 	for my $hash (@patches) {
 		my $FILE;
-		open($FILE, '-|', "git", "show", "--patch-with-stat", $hash) ||
+		open($FILE, '-|', "git",
+                     "-c", "diff.renamelimit=0",
+                     "-c", "diff.renames=True",
+                     "-c", "diff.algorithm=histogram",
+                     "show",
+                     "--patch-with-stat", $hash) ||
 			die "$P: git show $hash - $!\n";
 		while (<$FILE>) {
 			chomp;
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Alex Bennée

Rather than relying on external tweaks lets just do it inside checkpatch's direct commitish handling which is QEMU specific code anyway.

---
 .gitlab-ci.d/static_checks.yml | 3 ---
 .patchew.yml                   | 3 ---
 scripts/checkpatch.pl          | 7 ++++++-
 3 files changed, 6 insertions(+), 7 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
Reviewed-by on v1 1/1
#2 lore raw
In reply to Alex Bennée
Quoted 5 lines · Alex Bennée

Rather than relying on external tweaks lets just do it inside checkpatch's direct commitish handling which is QEMU specific code anyway.

Quoted 8 lines
---
 .gitlab-ci.d/static_checks.yml | 3 ---
 .patchew.yml                   | 3 ---
 scripts/checkpatch.pl          | 7 ++++++-
 3 files changed, 6 insertions(+), 7 deletions(-)
Reviewed-by on v1 1/1
#3 lore raw
In reply to Alex Bennée
Quoted 11 lines · Alex Bennée

Rather than relying on external tweaks lets just do it inside checkpatch's direct commitish handling which is QEMU specific code anyway.

---
 .gitlab-ci.d/static_checks.yml | 3 ---
 .patchew.yml                   | 3 ---
 scripts/checkpatch.pl          | 7 ++++++-
 3 files changed, 6 insertions(+), 7 deletions(-)

Clever.

Reviewed-by on v1 1/1
#4 lore raw
In reply to Alex Bennée
Quoted 9 lines · Alex Bennée

Rather than relying on external tweaks lets just do it inside checkpatch's direct commitish handling which is QEMU specific code anyway.

---
  .gitlab-ci.d/static_checks.yml | 3 ---
  .patchew.yml                   | 3 ---

ah, there is the patchew configuration file.

Quoted 2 lines
  scripts/checkpatch.pl          | 7 ++++++-
  3 files changed, 6 insertions(+), 7 deletions(-)
Quoted 47 lines
.gitlab-ci.d/static_checks.yml +0 -3
index 7e685c6a65..c5fa4fce26 100644
@@ -4,9 +4,6 @@ check-patch:
    needs:
      job: amd64-centos8-container
    script:
-    - git config --local diff.renamelimit 0
-    - git config --local diff.renames True
-    - git config --local diff.algorithm histogram
      - .gitlab-ci.d/check-patch.py
    variables:
      GIT_DEPTH: 1000
.patchew.yml +0 -3
index 2638b7f564..1b78262ce5 100644
@@ -138,9 +138,6 @@ testing:
        script: |
          #!/bin/bash
          git rev-parse base > /dev/null || exit 0
-        git config --local diff.renamelimit 0
-        git config --local diff.renames True
-        git config --local diff.algorithm histogram
          ./scripts/checkpatch.pl --mailback base..
      docker-mingw@fedora:
        enabled: true
scripts/checkpatch.pl +6 -1
index bbcd25ae05..cb8eff233e 100755
@@ -399,7 +399,12 @@ if ($chk_branch) {
  	my $num_patches = @patches;
  	for my $hash (@patches) {
  		my $FILE;
-		open($FILE, '-|', "git", "show", "--patch-with-stat", $hash) ||
+		open($FILE, '-|', "git",
+                     "-c", "diff.renamelimit=0",
+                     "-c", "diff.renames=True",
+                     "-c", "diff.algorithm=histogram",
+                     "show",
+                     "--patch-with-stat", $hash) ||
  			die "$P: git show $hash - $!\n";
  		while (<$FILE>) {
  			chomp;