DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] devtools: check for supported git version
@ 2022-10-24 15:37 Ali Alnubani
  2022-10-25  8:39 ` David Marchand
  2022-10-25 10:15 ` [PATCH v2] " Ali Alnubani
  0 siblings, 2 replies; 7+ messages in thread
From: Ali Alnubani @ 2022-10-24 15:37 UTC (permalink / raw)
  To: dev; +Cc: Thomas Monjalon

The script devtools/parse-flow-support.sh uses the git-grep
option (-o, --only-matching), which is only supported from
git version 2.19 and onwards.[1]

The script now exits early providing a clear message to the user
about the required git version instead of showing the following
error messages multiple times:
  error: unknown switch `o'
  usage: git grep [<options>] [-e] <pattern> [<rev>...] [[--] <path>...]
  [..]

[1] https://github.com/git/git/blob/v2.19.0/Documentation/RelNotes/2.19.0.txt

Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 devtools/parse-flow-support.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/devtools/parse-flow-support.sh b/devtools/parse-flow-support.sh
index 63c0b20e23..9c322249da 100755
--- a/devtools/parse-flow-support.sh
+++ b/devtools/parse-flow-support.sh
@@ -13,6 +13,12 @@ if [ -z "$dir" ]; then
 	exit 1
 fi
 
+# test git-grep for -o (--only-matching) option
+if ! git grep -qo git -- devtools/parse-flow-support.sh >/dev/null 2>&1; then
+	echo "git version >= 2.19 is required" >&2
+	exit 1
+fi
+
 # sorting order
 export LC_COLLATE=C
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] devtools: check for supported git version
  2022-10-24 15:37 [PATCH] devtools: check for supported git version Ali Alnubani
@ 2022-10-25  8:39 ` David Marchand
  2022-10-25 10:15 ` [PATCH v2] " Ali Alnubani
  1 sibling, 0 replies; 7+ messages in thread
From: David Marchand @ 2022-10-25  8:39 UTC (permalink / raw)
  To: Ali Alnubani; +Cc: dev, Thomas Monjalon

On Mon, Oct 24, 2022 at 5:38 PM Ali Alnubani <alialnu@nvidia.com> wrote:
>
> The script devtools/parse-flow-support.sh uses the git-grep
> option (-o, --only-matching), which is only supported from
> git version 2.19 and onwards.[1]
>
> The script now exits early providing a clear message to the user
> about the required git version instead of showing the following
> error messages multiple times:
>   error: unknown switch `o'
>   usage: git grep [<options>] [-e] <pattern> [<rev>...] [[--] <path>...]
>   [..]
>
> [1] https://github.com/git/git/blob/v2.19.0/Documentation/RelNotes/2.19.0.txt
>
> Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  devtools/parse-flow-support.sh | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/devtools/parse-flow-support.sh b/devtools/parse-flow-support.sh
> index 63c0b20e23..9c322249da 100755
> --- a/devtools/parse-flow-support.sh
> +++ b/devtools/parse-flow-support.sh
> @@ -13,6 +13,12 @@ if [ -z "$dir" ]; then
>         exit 1
>  fi
>
> +# test git-grep for -o (--only-matching) option
> +if ! git grep -qo git -- devtools/parse-flow-support.sh >/dev/null 2>&1; then

Would it work with $0, to refer to the script itself?


> +       echo "git version >= 2.19 is required" >&2
> +       exit 1
> +fi
> +
>  # sorting order
>  export LC_COLLATE=C
>
> --
> 2.25.1
>

-- 
David Marchand


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] devtools: check for supported git version
  2022-10-24 15:37 [PATCH] devtools: check for supported git version Ali Alnubani
  2022-10-25  8:39 ` David Marchand
@ 2022-10-25 10:15 ` Ali Alnubani
  2022-10-26  6:24   ` David Marchand
  1 sibling, 1 reply; 7+ messages in thread
From: Ali Alnubani @ 2022-10-25 10:15 UTC (permalink / raw)
  To: dev; +Cc: david.marchand, Thomas Monjalon

The script devtools/parse-flow-support.sh uses the git-grep
option (-o, --only-matching), which is only supported from
git version 2.19 and onwards.[1]

The script now exits early providing a clear message to the user
about the required git version instead of showing the following
error messages multiple times:
  error: unknown switch `o'
  usage: git grep [<options>] [-e] <pattern> [<rev>...] [[--] <path>...]
  [..]

[1] https://github.com/git/git/blob/v2.19.0/Documentation/RelNotes/2.19.0.txt

Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
Changes in v2:
- Refer to filename by $0 (Suggested by David Marchand).

 devtools/parse-flow-support.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/devtools/parse-flow-support.sh b/devtools/parse-flow-support.sh
index 63c0b20e23..9811c7881c 100755
--- a/devtools/parse-flow-support.sh
+++ b/devtools/parse-flow-support.sh
@@ -13,6 +13,12 @@ if [ -z "$dir" ]; then
 	exit 1
 fi
 
+# test git-grep for -o (--only-matching) option
+if ! git grep -qo git -- $0 >/dev/null 2>&1; then
+	echo "git version >= 2.19 is required" >&2
+	exit 1
+fi
+
 # sorting order
 export LC_COLLATE=C
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] devtools: check for supported git version
  2022-10-25 10:15 ` [PATCH v2] " Ali Alnubani
@ 2022-10-26  6:24   ` David Marchand
  2022-10-26  7:52     ` Ferruh Yigit
  0 siblings, 1 reply; 7+ messages in thread
From: David Marchand @ 2022-10-26  6:24 UTC (permalink / raw)
  To: Ali Alnubani; +Cc: dev, Thomas Monjalon

On Tue, Oct 25, 2022 at 12:15 PM Ali Alnubani <alialnu@nvidia.com> wrote:
>
> The script devtools/parse-flow-support.sh uses the git-grep
> option (-o, --only-matching), which is only supported from
> git version 2.19 and onwards.[1]
>
> The script now exits early providing a clear message to the user
> about the required git version instead of showing the following
> error messages multiple times:
>   error: unknown switch `o'
>   usage: git grep [<options>] [-e] <pattern> [<rev>...] [[--] <path>...]
>   [..]
>
> [1] https://github.com/git/git/blob/v2.19.0/Documentation/RelNotes/2.19.0.txt
>
> Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>

I don't have a "non working" git, but the patch lgtm.

Acked-by: David Marchand <david.marchand@redhat.com>


-- 
David Marchand


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] devtools: check for supported git version
  2022-10-26  6:24   ` David Marchand
@ 2022-10-26  7:52     ` Ferruh Yigit
  2022-10-26  8:34       ` Chaoyong He
  0 siblings, 1 reply; 7+ messages in thread
From: Ferruh Yigit @ 2022-10-26  7:52 UTC (permalink / raw)
  To: David Marchand, Ali Alnubani, Chaoyong He; +Cc: dev, Thomas Monjalon

On 10/26/2022 7:24 AM, David Marchand wrote:
> On Tue, Oct 25, 2022 at 12:15 PM Ali Alnubani <alialnu@nvidia.com> wrote:
>>
>> The script devtools/parse-flow-support.sh uses the git-grep
>> option (-o, --only-matching), which is only supported from
>> git version 2.19 and onwards.[1]
>>
>> The script now exits early providing a clear message to the user
>> about the required git version instead of showing the following
>> error messages multiple times:
>>    error: unknown switch `o'
>>    usage: git grep [<options>] [-e] <pattern> [<rev>...] [[--] <path>...]
>>    [..]
>>
>> [1] https://github.com/git/git/blob/v2.19.0/Documentation/RelNotes/2.19.0.txt
>>
>> Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
>> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> 
> I don't have a "non working" git, but the patch lgtm.
> 
> Acked-by: David Marchand <david.marchand@redhat.com>
> 

+Chaoyong,

He had observed the problem, perhaps he can help to test.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH v2] devtools: check for supported git version
  2022-10-26  7:52     ` Ferruh Yigit
@ 2022-10-26  8:34       ` Chaoyong He
  2022-10-31 15:46         ` Thomas Monjalon
  0 siblings, 1 reply; 7+ messages in thread
From: Chaoyong He @ 2022-10-26  8:34 UTC (permalink / raw)
  To: Ferruh Yigit, David Marchand, Ali Alnubani; +Cc: dev, Thomas Monjalon

> On 10/26/2022 7:24 AM, David Marchand wrote:
> > On Tue, Oct 25, 2022 at 12:15 PM Ali Alnubani <alialnu@nvidia.com> wrote:
> >>
> >> The script devtools/parse-flow-support.sh uses the git-grep option
> >> (-o, --only-matching), which is only supported from git version 2.19
> >> and onwards.[1]
> >>
> >> The script now exits early providing a clear message to the user
> >> about the required git version instead of showing the following error
> >> messages multiple times:
> >>    error: unknown switch `o'
> >>    usage: git grep [<options>] [-e] <pattern> [<rev>...] [[--] <path>...]
> >>    [..]
> >>
> >> [1]
> >> https://github.com/git/git/blob/v2.19.0/Documentation/RelNotes/2.19.0
> >> .txt
> >>
> >> Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
> >> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> >
> > I don't have a "non working" git, but the patch lgtm.
> >
> > Acked-by: David Marchand <david.marchand@redhat.com>
> >
> 
> +Chaoyong,
> 
> He had observed the problem, perhaps he can help to test.

I test in my host, it does work.

$ git --version
git version 2.18.5

Before this patch:
$ ./devtools/check-doc-vs-code.sh
error: unknown switch `o'
usage: git grep [<options>] [-e] <pattern> [<rev>...] [[--] <path>...]
    --cached              search in index instead of in the work tree
    ...
repeat many times.

After this patch:
$ ./devtools/check-doc-vs-code.sh
git version >= 2.19 is required


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] devtools: check for supported git version
  2022-10-26  8:34       ` Chaoyong He
@ 2022-10-31 15:46         ` Thomas Monjalon
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2022-10-31 15:46 UTC (permalink / raw)
  To: Ali Alnubani; +Cc: Ferruh Yigit, David Marchand, dev, Chaoyong He

26/10/2022 10:34, Chaoyong He:
> > On 10/26/2022 7:24 AM, David Marchand wrote:
> > > On Tue, Oct 25, 2022 at 12:15 PM Ali Alnubani <alialnu@nvidia.com> wrote:
> > >>
> > >> The script devtools/parse-flow-support.sh uses the git-grep option
> > >> (-o, --only-matching), which is only supported from git version 2.19
> > >> and onwards.[1]
> > >>
> > >> The script now exits early providing a clear message to the user
> > >> about the required git version instead of showing the following error
> > >> messages multiple times:
> > >>    error: unknown switch `o'
> > >>    usage: git grep [<options>] [-e] <pattern> [<rev>...] [[--] <path>...]
> > >>    [..]
> > >>
> > >> [1]
> > >> https://github.com/git/git/blob/v2.19.0/Documentation/RelNotes/2.19.0
> > >> .txt
> > >>
> > >> Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
> > >> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > >
> > > I don't have a "non working" git, but the patch lgtm.
> > >
> > > Acked-by: David Marchand <david.marchand@redhat.com>
> > >
> > 
> > +Chaoyong,
> > 
> > He had observed the problem, perhaps he can help to test.
> 
> I test in my host, it does work.
> 
> $ git --version
> git version 2.18.5
> 
> Before this patch:
> $ ./devtools/check-doc-vs-code.sh
> error: unknown switch `o'
> usage: git grep [<options>] [-e] <pattern> [<rev>...] [[--] <path>...]
>     --cached              search in index instead of in the work tree
>     ...
> repeat many times.
> 
> After this patch:
> $ ./devtools/check-doc-vs-code.sh
> git version >= 2.19 is required

Applied, thanks.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-10-31 15:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-24 15:37 [PATCH] devtools: check for supported git version Ali Alnubani
2022-10-25  8:39 ` David Marchand
2022-10-25 10:15 ` [PATCH v2] " Ali Alnubani
2022-10-26  6:24   ` David Marchand
2022-10-26  7:52     ` Ferruh Yigit
2022-10-26  8:34       ` Chaoyong He
2022-10-31 15:46         ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).