All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Andy Whitcroft <apw@shadowen.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] checkpatch: Allow not using -f with files that are in git
Date: Sun, 18 Oct 2020 16:03:15 +0200	[thread overview]
Message-ID: <CAMuHMdV8FEPhTp653RN00LK4UcQZHkuLByJzqiM85r2qoqhDvQ@mail.gmail.com> (raw)
In-Reply-To: <45b81a48e1568bd0126a96f5046eb7aaae9b83c9.camel@perches.com>

Hi Joe,

On Tue, Aug 25, 2020 at 2:12 AM Joe Perches <joe@perches.com> wrote:
> If a file exists in git and checkpatch is used without the -f
> flag for scanning a file, then checkpatch will scan the file
> assuming it's a patch and emit:
>
> ERROR: Does not appear to be a unified-diff format patch
>
> Change the behavior to assume the -f flag if the file exists
> in git.
>
> Signed-off-by: Joe Perches <joe@perches.com>

Thanks for your patch!

> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -976,6 +976,16 @@ sub seed_camelcase_includes {
>         }
>  }
>
> +sub git_is_single_file {
> +       my ($filename) = @_;
> +
> +       return 0 if ((which("git") eq "") || !(-e "$gitroot"));
> +
> +       my $output = `${git_command} ls-files -- $filename`;
> +       my $count = $output =~ tr/\n//;
> +       return $count eq 1 && $output =~ m{^${filename}$};
> +}
> +
>  sub git_commit_info {
>         my ($commit, $id, $desc) = @_;
>

This is now commit f5f613259f3fea81 ("checkpatch: allow not using -f
with files that are in git"), causing:

    Global symbol "$gitroot" requires explicit package name (did you
forget to declare "my $gitroot"?) at scripts/checkpatch.pl line 980.
    Execution of scripts/checkpatch.pl aborted due to compilation errors.

FWIW, host system is running Ubuntu 18.04.5 LTS (upgrade to 20.04 LTS
planned soon ;-).

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  parent reply	other threads:[~2020-10-18 14:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-25  0:09 [PATCH] checkpatch: Allow not using -f with files that are in git Joe Perches
2020-08-25 12:23 ` Rasmus Villemoes
2020-08-28  8:03   ` Joe Perches
2020-08-28 18:17   ` Joe Perches
2020-09-13  4:02 ` Joe Perches
2020-10-18 14:03 ` Geert Uytterhoeven [this message]
2020-10-18 16:07   ` Joe Perches
2020-10-18 18:15     ` Geert Uytterhoeven
2020-10-18 18:26       ` Joe Perches
2020-10-24  0:04         ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMuHMdV8FEPhTp653RN00LK4UcQZHkuLByJzqiM85r2qoqhDvQ@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=akpm@linux-foundation.org \
    --cc=apw@shadowen.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.