{"thread":{"id":"13799","subject":"[PATCH] describe: match pattern for lightweight tags too","startedAt":"2008-06-04T19:06:31Z","lastAt":"2008-06-04T20:09:52Z","messageCount":3,"participants":["Michael Dressel","Shawn O. Pearce","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"78651","messageId":"alpine.LNX.1.10.0806042101080.3410@pollux","threadId":"13799","inReplyTo":null,"subject":"[PATCH] describe: match pattern for lightweight tags too","fromName":"Michael Dressel","fromEmail":"michaeltilodressel@t-online.de","sentAt":"2008-06-04T19:06:31Z","receivedAt":"2008-06-04T19:06:31Z","isPatch":true,"sender":{"key":"michaeltilodressel@t-online.de","avatar":null},"body":"\nSo far git describe --match <pattern> would apply the <pattern> only\nto tag objects not to lightweight tags. This change make describe apply\nthe <pattern> to lightweight tags too.\n\nSigned-off-by: Michael Dressel <MichaelTiloDressel@t-online.de>\n---\n  builtin-describe.c |    9 +++++----\n  1 files changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin-describe.c b/builtin-describe.c\nindex df554b3..3da99c1 100644\n--- a/builtin-describe.c\n+++ b/builtin-describe.c\n@@ -80,12 +80,13 @@ static int get_name(const char *path, const unsigned char *sha1, int flag, void\n  \t * Otherwise only annotated tags are used.\n  \t */\n  \tif (might_be_tag) {\n-\t\tif (is_tag) {\n+\t\tif (is_tag)\n  \t\t\tprio = 2;\n-\t\t\tif (pattern && fnmatch(pattern, path + 10, 0))\n-\t\t\t\tprio = 0;\n-\t\t} else\n+\t\telse\n  \t\t\tprio = 1;\n+\n+\t\tif (pattern && fnmatch(pattern, path + 10, 0))\n+\t\t\tprio = 0;\n  \t}\n  \telse\n  \t\tprio = 0;\n-- \n1.5.5.3\n"},{"id":"78656","messageId":"20080604195516.GT12896@spearce.org","threadId":"13799","inReplyTo":"alpine.LNX.1.10.0806042101080.3410@pollux","subject":"Re: [PATCH] describe: match pattern for lightweight tags too","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-06-04T19:55:16Z","receivedAt":"2008-06-04T19:55:16Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Michael Dressel <MichaelTiloDressel@t-online.de> wrote:\n> \n> So far git describe --match <pattern> would apply the <pattern> only\n> to tag objects not to lightweight tags. This change make describe apply\n> the <pattern> to lightweight tags too.\n> \n> Signed-off-by: Michael Dressel <MichaelTiloDressel@t-online.de>\n\nAcked-by: Shawn O. Pearce <spearce@spearce.org>\n\n> diff --git a/builtin-describe.c b/builtin-describe.c\n> index df554b3..3da99c1 100644\n> --- a/builtin-describe.c\n> +++ b/builtin-describe.c\n> @@ -80,12 +80,13 @@ static int get_name(const char *path, const unsigned \n> char *sha1, int flag, void\n>  \t * Otherwise only annotated tags are used.\n>  \t */\n>  \tif (might_be_tag) {\n> -\t\tif (is_tag) {\n> +\t\tif (is_tag)\n>  \t\t\tprio = 2;\n> -\t\t\tif (pattern && fnmatch(pattern, path + 10, 0))\n> -\t\t\t\tprio = 0;\n> -\t\t} else\n> +\t\telse\n>  \t\t\tprio = 1;\n> +\n> +\t\tif (pattern && fnmatch(pattern, path + 10, 0))\n> +\t\t\tprio = 0;\n>  \t}\n>  \telse\n>  \t\tprio = 0;\n\n-- \nShawn.\n"},{"id":"78663","messageId":"7vod6hvu5r.fsf@gitster.siamese.dyndns.org","threadId":"13799","inReplyTo":"20080604195516.GT12896@spearce.org","subject":"Re: [PATCH] describe: match pattern for lightweight tags too","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-04T20:09:52Z","receivedAt":"2008-06-04T20:09:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks both.  I've reworded the log message to make it clear that this is\nnot a random new feature but is a bugfix.\n\n-- >8 --\nFrom: Michael Dressel <MichaelTiloDressel@t-online.de>\nDate: Wed, 4 Jun 2008 21:06:31 +0200\nSubject: [PATCH] describe: match pattern for lightweight tags too\n\nThe <pattern> given \"git describe --match\" was used only to filter tag\nobjects, and not to filter lightweight tags.  This fixes it.\n\n[jc: made the log to clarify this is a bugfix, not an enhancement, with\nadditional test]\n\nSigned-off-by: Michael Dressel <MichaelTiloDressel@t-online.de>\nAcked-by: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin-describe.c  |    9 +++++----\n t/t6120-describe.sh |   22 ++++++++++++++++++++++\n 2 files changed, 27 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin-describe.c b/builtin-describe.c\nindex df554b3..3da99c1 100644\n--- a/builtin-describe.c\n+++ b/builtin-describe.c\n@@ -80,12 +80,13 @@ static int get_name(const char *path, const unsigned char *sha1, int flag, void\n \t * Otherwise only annotated tags are used.\n \t */\n \tif (might_be_tag) {\n-\t\tif (is_tag) {\n+\t\tif (is_tag)\n \t\t\tprio = 2;\n-\t\t\tif (pattern && fnmatch(pattern, path + 10, 0))\n-\t\t\t\tprio = 0;\n-\t\t} else\n+\t\telse\n \t\t\tprio = 1;\n+\n+\t\tif (pattern && fnmatch(pattern, path + 10, 0))\n+\t\t\tprio = 0;\n \t}\n \telse\n \t\tprio = 0;\ndiff --git a/t/t6120-describe.sh b/t/t6120-describe.sh\nindex 56bbd85..c6bfef5 100755\n--- a/t/t6120-describe.sh\n+++ b/t/t6120-describe.sh\n@@ -117,4 +117,26 @@ test_expect_success 'rename tag Q back to A' '\n test_expect_success 'pack tag refs' 'git pack-refs'\n check_describe A-* HEAD\n \n+test_expect_success 'set-up matching pattern tests' '\n+\tgit tag -a -m test-annotated test-annotated &&\n+\techo >>file &&\n+\ttest_tick &&\n+\tgit commit -a -m \"one more\" &&\n+\tgit tag test1-lightweight &&\n+\techo >>file &&\n+\ttest_tick &&\n+\tgit commit -a -m \"yet another\" &&\n+\tgit tag test2-lightweight &&\n+\techo >>file &&\n+\ttest_tick &&\n+\tgit commit -a -m \"even more\"\n+\n+'\n+\n+check_describe \"test-annotated-*\" --match=\"test-*\"\n+\n+check_describe \"test1-lightweight-*\" --tags --match=\"test1-*\"\n+\n+check_describe \"test2-lightweight-*\" --tags --match=\"test2-*\"\n+\n test_done\n-- \n1.5.6.rc1.5.gadf60\n"}]}