Volume XXII, number 280Wednesday, October 7, 2026Latest message 54 minutes ago

The Git List

News and archive of git@vger.kernel.org, since April 2005

patchdescribe: bail of --contains --all is used with --exclude or --match

4 messages between Feb 26, 2019 and May 28, 2026, from Jacob Keller, Eric Sunshine, Tuomas Ahola.

Plain Markdown or JSON for tools and agents. Diffs are folded; open one to read it.

Jacob KellerFeb 26, 2019, 21:53 UTC on lore
From: Jacob Keller <jacob.keller@gmail.com>

If you try to use git describe --contains with --all, the exclude and match patterns are silently ignored.

This results in unexpected behavior, as you may try to provide patterns and expect it to change the result.

Check for this, and have describe die when it encounters this, instead of silently ignoring the provided options.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
---

I just found this while trying to use it, the patterns weren't being applied properly.

This is pretty quick/dirty, I haven't had time to write a test, or anything.
 builtin/describe.c | 3 +++
 1 file changed, 3 insertions(+)
Show changes to builtin/describe.c +3 −0
diff --git a/builtin/describe.c b/builtin/describe.c
index 1409cedce2fb..1bf4b6e3d0ae 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -589,6 +589,9 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
 				argv_array_pushf(&args, "--refs=refs/tags/%s", item->string);
 			for_each_string_list_item(item, &exclude_patterns)
 				argv_array_pushf(&args, "--exclude=refs/tags/%s", item->string);
+		} else {
+			if (patterns.nr || exclude_patterns.nr)
+				die(_("--contains with --all does not support --match or --exclude"));
 		}
 		if (argc)
 			argv_array_pushv(&args, argv);
-- 
2.18.0.219.gaf81d287a9da
Eric SunshineFeb 26, 2019, 23:34 UTC in reply to Jacob Keller on lore

Re: [PATCH] describe: bail of --contains --all is used with --exclude or --match

On Tue, Feb 26, 2019 at 4:54 PM Jacob Keller <jacob.e.keller@intel.com> wrote:
> describe: bail of --contains --all is used with --exclude or --match
s/of/if/
Show 10 quoted lines
> Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
> ---
> diff --git a/builtin/describe.c b/builtin/describe.c
> @@ -589,6 +589,9 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
>                         for_each_string_list_item(item, &exclude_patterns)
>                                 argv_array_pushf(&args, "--exclude=refs/tags/%s", item->string);
> +               } else {
> +                       if (patterns.nr || exclude_patterns.nr)
> +                               die(_("--contains with --all does not support --match or --exclude"));
>                 }
Could be folded into an 'else if':
    } else if (patterns.nr || exclude_patterns.nr) {
        die(...);
    }
but not worth a re-roll.
Tuomas AholaMay 19, 2026, 08:35 UTC in reply to Jacob Keller on lore

Re: [PATCH] describe: bail of --contains --all is used with --exclude or --match

Jacob Keller <jacob.e.keller@intel.com> wrote:
Show 8 quoted lines
> From: Jacob Keller <jacob.keller@gmail.com>
> 
> If you try to use git describe --contains with --all, the exclude and
> match patterns are silently ignored.
> 
> This results in unexpected behavior, as you may try to provide patterns
> and expect it to change the result.
> 
I got just bitten by that, and yes, it was quite unexpected.
Show 11 quoted lines
> Check for this, and have describe die when it encounters this, instead
> of silently ignoring the provided options.
> 
> Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
> ---
> 
> I just found this while trying to use it, the patterns weren't being applied
> properly.
> 
> This is pretty quick/dirty, I haven't had time to write a test, or anything.
> 

Would you like to resurrect the patch? It seems it was never merged, nor the underlying problem fixed:

``` $ git describe --contains --all --match=bogus master $ git describe --contains --all --exclude="*" master ```

>  builtin/describe.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
>  [...]
--Tuomas
Jacob KellerMay 28, 2026, 00:43 UTC in reply to Tuomas Ahola on lore

Re: [PATCH] describe: bail of --contains --all is used with --exclude or --match

On Tue, May 19, 2026 at 1:36 AM Tuomas Ahola <taahol@utu.fi> wrote:
Show 36 quoted lines
>
> Jacob Keller <jacob.e.keller@intel.com> wrote:
>
> > From: Jacob Keller <jacob.keller@gmail.com>
> >
> > If you try to use git describe --contains with --all, the exclude and
> > match patterns are silently ignored.
> >
> > This results in unexpected behavior, as you may try to provide patterns
> > and expect it to change the result.
> >
>
> I got just bitten by that, and yes, it was quite unexpected.
>
> > Check for this, and have describe die when it encounters this, instead
> > of silently ignoring the provided options.
> >
> > Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
> > ---
> >
> > I just found this while trying to use it, the patterns weren't being applied
> > properly.
> >
> > This is pretty quick/dirty, I haven't had time to write a test, or anything.
> >
>
> Would you like to resurrect the patch?  It seems it was never merged,
> nor the underlying problem fixed:
>
> ```
> $ git describe --contains --all --match=bogus
> master
> $ git describe --contains --all --exclude="*"
> master
> ```
>
Apologies for a delayed response. I'll try to look into reviving this tomorrow.

Back to recent threads

[PATCH] describe: bail of --contains --all is used with --exclude or --match | The Git List