{"thread":{"id":"50599","subject":"[PATCH] describe: bail of --contains --all is used with --exclude or --match","startedAt":"2019-02-26T21:53:52Z","lastAt":"2026-05-28T00:43:45Z","messageCount":4,"participants":["Jacob Keller","Eric Sunshine","Tuomas Ahola"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"370279","messageId":"20190226215348.5119-1-jacob.e.keller@intel.com","threadId":"50599","inReplyTo":null,"subject":"[PATCH] describe: bail of --contains --all is used with --exclude or --match","fromName":"Jacob Keller","fromEmail":"jacob.e.keller@intel.com","sentAt":"2019-02-26T21:53:48Z","receivedAt":"2019-02-26T21:53:52Z","isPatch":true,"body":"From: Jacob Keller <jacob.keller@gmail.com>\n\nIf you try to use git describe --contains with --all, the exclude and\nmatch patterns are silently ignored.\n\nThis results in unexpected behavior, as you may try to provide patterns\nand expect it to change the result.\n\nCheck for this, and have describe die when it encounters this, instead\nof silently ignoring the provided options.\n\nSigned-off-by: Jacob Keller <jacob.keller@gmail.com>\n---\n\nI just found this while trying to use it, the patterns weren't being applied\nproperly.\n\nThis is pretty quick/dirty, I haven't had time to write a test, or anything.\n\n builtin/describe.c | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex 1409cedce2fb..1bf4b6e3d0ae 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -589,6 +589,9 @@ int cmd_describe(int argc, const char **argv, const char *prefix)\n \t\t\t\targv_array_pushf(&args, \"--refs=refs/tags/%s\", item->string);\n \t\t\tfor_each_string_list_item(item, &exclude_patterns)\n \t\t\t\targv_array_pushf(&args, \"--exclude=refs/tags/%s\", item->string);\n+\t\t} else {\n+\t\t\tif (patterns.nr || exclude_patterns.nr)\n+\t\t\t\tdie(_(\"--contains with --all does not support --match or --exclude\"));\n \t\t}\n \t\tif (argc)\n \t\t\targv_array_pushv(&args, argv);\n-- \n2.18.0.219.gaf81d287a9da\n\n"},{"id":"370284","messageId":"CAPig+cR8n05zvzxFnbyGm08hEHTTTozzGY1DTE1SvDxsuPPTfw@mail.gmail.com","threadId":"50599","inReplyTo":"20190226215348.5119-1-jacob.e.keller@intel.com","subject":"Re: [PATCH] describe: bail of --contains --all is used with --exclude or --match","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2019-02-26T23:34:23Z","receivedAt":"2019-02-26T23:34:35Z","isPatch":true,"body":"On Tue, Feb 26, 2019 at 4:54 PM Jacob Keller <jacob.e.keller@intel.com> wrote:\n> describe: bail of --contains --all is used with --exclude or --match\n\ns/of/if/\n\n> Signed-off-by: Jacob Keller <jacob.keller@gmail.com>\n> ---\n> diff --git a/builtin/describe.c b/builtin/describe.c\n> @@ -589,6 +589,9 @@ int cmd_describe(int argc, const char **argv, const char *prefix)\n>                         for_each_string_list_item(item, &exclude_patterns)\n>                                 argv_array_pushf(&args, \"--exclude=refs/tags/%s\", item->string);\n> +               } else {\n> +                       if (patterns.nr || exclude_patterns.nr)\n> +                               die(_(\"--contains with --all does not support --match or --exclude\"));\n>                 }\n\nCould be folded into an 'else if':\n\n    } else if (patterns.nr || exclude_patterns.nr) {\n        die(...);\n    }\n\nbut not worth a re-roll.\n"},{"id":"543607","messageId":"20260519083559.onq6r%taahol@utu.fi","threadId":"50599","inReplyTo":"20190226215348.5119-1-jacob.e.keller@intel.com","subject":"Re: [PATCH] describe: bail of --contains --all is used with --exclude or --match","fromName":"Tuomas Ahola","fromEmail":"taahol@utu.fi","sentAt":"2026-05-19T08:35:59Z","receivedAt":"2026-05-19T08:36:19Z","isPatch":true,"body":"Jacob Keller <jacob.e.keller@intel.com> wrote:\n\n> From: Jacob Keller <jacob.keller@gmail.com>\n> \n> If you try to use git describe --contains with --all, the exclude and\n> match patterns are silently ignored.\n> \n> This results in unexpected behavior, as you may try to provide patterns\n> and expect it to change the result.\n> \n\nI got just bitten by that, and yes, it was quite unexpected.\n\n> Check for this, and have describe die when it encounters this, instead\n> of silently ignoring the provided options.\n> \n> Signed-off-by: Jacob Keller <jacob.keller@gmail.com>\n> ---\n> \n> I just found this while trying to use it, the patterns weren't being applied\n> properly.\n> \n> This is pretty quick/dirty, I haven't had time to write a test, or anything.\n> \n\nWould you like to resurrect the patch?  It seems it was never merged,\nnor the underlying problem fixed:\n\n```\n$ git describe --contains --all --match=bogus\nmaster\n$ git describe --contains --all --exclude=\"*\"\nmaster\n```\n\n>  builtin/describe.c | 3 +++\n>  1 file changed, 3 insertions(+)\n> \n>  [...]\n\n\n--Tuomas\n"},{"id":"544200","messageId":"CA+P7+xr0tP6Ft3qPwbkxNRgNB2a24_WFC+8DymFnm11Ks=sf5g@mail.gmail.com","threadId":"50599","inReplyTo":"20260519083559.onq6r%taahol@utu.fi","subject":"Re: [PATCH] describe: bail of --contains --all is used with --exclude or --match","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2026-05-28T00:43:32Z","receivedAt":"2026-05-28T00:43:45Z","isPatch":true,"body":"On Tue, May 19, 2026 at 1:36 AM Tuomas Ahola <taahol@utu.fi> wrote:\n>\n> Jacob Keller <jacob.e.keller@intel.com> wrote:\n>\n> > From: Jacob Keller <jacob.keller@gmail.com>\n> >\n> > If you try to use git describe --contains with --all, the exclude and\n> > match patterns are silently ignored.\n> >\n> > This results in unexpected behavior, as you may try to provide patterns\n> > and expect it to change the result.\n> >\n>\n> I got just bitten by that, and yes, it was quite unexpected.\n>\n> > Check for this, and have describe die when it encounters this, instead\n> > of silently ignoring the provided options.\n> >\n> > Signed-off-by: Jacob Keller <jacob.keller@gmail.com>\n> > ---\n> >\n> > I just found this while trying to use it, the patterns weren't being applied\n> > properly.\n> >\n> > This is pretty quick/dirty, I haven't had time to write a test, or anything.\n> >\n>\n> Would you like to resurrect the patch?  It seems it was never merged,\n> nor the underlying problem fixed:\n>\n> ```\n> $ git describe --contains --all --match=bogus\n> master\n> $ git describe --contains --all --exclude=\"*\"\n> master\n> ```\n>\n\nApologies for a delayed response. I'll try to look into reviving this tomorrow.\n"}]}