diff mbox

[ovs-dev] Add a git-checkpatches script

Message ID 1496925567-11752-2-git-send-email-majopela@redhat.com
State Superseded
Headers show

Commit Message

Miguel Angel Ajo June 8, 2017, 12:39 p.m. UTC
From: Miguel Angel Ajo <majopela@redhat.com>

This utility script exports the on the tail of your current branch,
and runs utilities/checkpatch.py on each of them.

Signed-off-by: Miguel Angel Ajo <majopela@redhat.com>
---
 utilities/git-checkpatches | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100755 utilities/git-checkpatches

Comments

Ben Pfaff June 14, 2017, 8:43 p.m. UTC | #1
On Thu, Jun 08, 2017 at 12:39:27PM +0000, majopela@redhat.com wrote:
> From: Miguel Angel Ajo <majopela@redhat.com>
> 
> This utility script exports the on the tail of your current branch,
> and runs utilities/checkpatch.py on each of them.
> 
> Signed-off-by: Miguel Angel Ajo <majopela@redhat.com>

I'm not a big fan of the name because it makes it sound like a
general-purpose tool for Git repositories.

We can pretty easily integrate this into checkpatch itself:
        https://patchwork.ozlabs.org/patch/775978/
Miguel Angel Ajo June 28, 2017, 1:19 p.m. UTC | #2
Wow Ben, I hadn't seen your "updated patch".

Sounds great, checkpatch integration is even better :)

Best regards, and thanks,
Migue Ángel

On Wed, Jun 14, 2017 at 10:43 PM, Ben Pfaff <blp@ovn.org> wrote:

> On Thu, Jun 08, 2017 at 12:39:27PM +0000, majopela@redhat.com wrote:
> > From: Miguel Angel Ajo <majopela@redhat.com>
> >
> > This utility script exports the on the tail of your current branch,
> > and runs utilities/checkpatch.py on each of them.
> >
> > Signed-off-by: Miguel Angel Ajo <majopela@redhat.com>
>
> I'm not a big fan of the name because it makes it sound like a
> general-purpose tool for Git repositories.
>
> We can pretty easily integrate this into checkpatch itself:
>         https://patchwork.ozlabs.org/patch/775978/
>
diff mbox

Patch

diff --git a/utilities/git-checkpatches b/utilities/git-checkpatches
new file mode 100755
index 0000000..d25f41f
--- /dev/null
+++ b/utilities/git-checkpatches
@@ -0,0 +1,26 @@ 
+#!/bin/sh
+
+# usage: git-checkpatches [number of patches]
+#
+# this script can be used to pass checkpatch on a set of patches
+# of your git history
+#
+
+# just one patch by default
+PATCHES=${1:-1}
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+TMPDIR=$(mktemp -d)
+
+git_span="HEAD~$PATCHES..HEAD"
+
+echo "Checking patches $git_span"
+
+git format-patch -n $git_span -o $TMPDIR
+for patch in $TMPDIR/*.patch; do
+    echo "Checking patch $patch ========================"
+    $DIR/checkpatch.py $patch
+    echo ""
+done
+
+rm -rf $TMPDIR