On Wed, May 03, 2017 at 11:25:03AM -0400, Aaron Conole wrote:
> Ben Pfaff <[email protected]> writes:
> 
> > On Tue, May 02, 2017 at 12:24:53PM -0400, Aaron Conole wrote:
> >> Ben Pfaff <[email protected]> writes:
> >> 
> >> > On Mon, May 01, 2017 at 04:39:30PM -0400, Aaron Conole wrote:
> >> >> Ben Pfaff <[email protected]> writes:
> >> >> 
> >> >> > On Mon, May 01, 2017 at 04:14:09PM -0400, Aaron Conole wrote:
> >> >> >> A common way of expressing 'raise to the power of' when authoring
> >> >> >> comments uses **.  This is currently getting caught by the pointer
> >> >> >> spacing warning.  So, catch it here.
> >> >> >> 
> >> >> >> Reported-by: Lance Richardson <[email protected]>
> >> >> >> Signed-off-by: Aaron Conole <[email protected]>
> >> >> >
> >> >> > Thanks a lot for improving checkpatch, it should be helpful for
> >> >> > review.
> >> >> 
> >> >> Thank you for the incrementals, and review.
> >> >> 
> >> >> > Maybe I'll start using it in my review process.
> >> >> 
> >> >> I use it by default in all of my development.  The following is my
> >> >> .git/hooks/pre-commit:
> >> >> 
> >> >>   #!/bin/sh
> >> >>   if git rev-parse --verify HEAD 2>/dev/null
> >> >>   then
> >> >>       git diff-index -p --cached HEAD
> >> >>   else
> >> >>       :
> >> >>   fi | utilities/checkpatch.py -s
> >> >> 
> >> >> > I applied all of these patches to master.
> >> >
> >> > Oh, interesting.
> >> >
> >> > I'm playing with it by applying the following and then changing my
> >> > "mutt" shortcut for applying a patch from
> >> >     cd ~/nicira/ovs && git am -s
> >> > to
> >> >     cd ~/nicira/ovs && checkpatch.py -p | git am -s
> >> >
> >> > I'm not sure whether my patch makes sense, but it makes me feel clever
> >> > either way.
> >> 
> >> :)  If it works - I don't know what the erroring output will do to the
> >> git am input parser, but my guess is blow up (which is probably what you
> >> want anyway).  I looked for solutions that use a git hook, but it seems
> >> they all blow up whenever anything more trivial happens, so there's
> >> probably not yet a slick solution.  With that said,
> >> 
> >> Acked-by: Aaron Conole <[email protected]>
> >
> > I'm experimenting with it, I'm not aiming to commit it, at least not
> > yet.
> >
> > I had the idea that checkpatch sent its errors to stderr, but I was
> > wrong.  I ended up modifying my patch to make it do that.  I don't know
> > whether it's ideal.  Maybe I should use it in a way that doesn't require
> > pass-through, which isn't a customary mode for this kind of tool.
> 
> According to the git docs, the git pre-commit hook is invoked by `git
> am` when the default pre-applypatch hook is enabled.  I have my
> pre-commit setup already.  So, I just did (from top level):
> 
>   $ cp .git/hooks/pre-applypatch.sample .git/hooks/pre-applypatch
> 
> Then I took a random patch file, and modified a file to have bad spacing,
> then did `git am`, with these results:
> 
>   $ cp .git/hooks/pre-applypatch.sample .git/hooks/pre-applypatch
>   $ git am 0001-borked-patch.patch
>   Applying: rhel: fix the fedora spec
>   WARNING: Line has non-spaces leading whitespace
>   #10 FILE: b/rhel/openvswitch-fedora.spec.in:233:
>       install -d -m 0755 $RPM_BUILD_ROOT%{_rundir}/openvswitch
> 
>   WARNING: Line has non-spaces leading whitespace
>   #11 FILE: b/rhel/openvswitch-fedora.spec.in:234:
>       install -d -m 0755 $RPM_BUILD_ROOT%{_localstatedir}/log/openvswitch
> 
>   $ git status
>   On branch master
>   You are in the middle of an am session.
>     (fix conflicts and then run "git am --continue")
>     (use "git am --skip" to skip this patch)
>     (use "git am --abort" to restore the original branch)
> 
>   Changes to be committed:
>     (use "git reset HEAD <file>..." to unstage)
> 
>       modified:   rhel/openvswitch-fedora.spec.in
> 
> May be that is what you're looking for?

Maybe I should use that, sure.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to