{"thread":{"id":"6617","subject":"precise keyword matching for pretty switch","startedAt":"2007-02-01T22:43:40Z","lastAt":"2007-02-02T13:17:53Z","messageCount":2,"participants":["Nicolas Vilz","Eric Wong"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"33302","messageId":"20070201224339.GA29666@hermes.lan.home.vilz.de","threadId":"6617","inReplyTo":null,"subject":"precise keyword matching for pretty switch","fromName":"Nicolas Vilz","fromEmail":"niv@iaglans.de","sentAt":"2007-02-01T22:43:40Z","receivedAt":"2007-02-01T22:43:40Z","isPatch":false,"sender":{"key":"niv@iaglans.de","avatar":"https://gravatar.com/avatar/e4d43a32d721241212d4edb1d2210327e28423c913071b4bfeeaa0ce15296110?d=mp&s=160"},"body":"hi,\n\ni noticed today, that the pretty-switch in git-log -diff and many other\ntools triggers to \"oneline\" if you just type an \"o\" after --pretty=\n\nso, not only \n\ngit log --pretty=oneline\n\nbut also\n\ngit log --pretty=online\ngit log --pretty=offline\ngit log --pretty=omfg\n\nand finally (just to make it short *G*)\n\ngit log --pretty=osolomio\n\ndoes trigger the oneline-feature. Perhaps this is not intended to work\nas it works now. I would recommend, that the switch should only accept\nthe fully matched keyword and not just a lowercase \"o\" as the first\nletter of the keywords following after --pretty=, just to prevent people \ngetting bad habbits.\n\nI noticed this by accident, because i made a typo (i typed \"online\" a few\ntimes, and then noticed that an o is sufficient), perhaps nobody else\nnoticed before.\n\nSincerly\nNicolas\n\n"},{"id":"33377","messageId":"20070202131752.GA32248@localdomain","threadId":"6617","inReplyTo":"20070201224339.GA29666@hermes.lan.home.vilz.de","subject":"Re: precise keyword matching for pretty switch","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-02-02T13:17:53Z","receivedAt":"2007-02-02T13:17:53Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Nicolas Vilz <niv@iaglans.de> wrote:\n> hi,\n> \n> i noticed today, that the pretty-switch in git-log -diff and many other\n> tools triggers to \"oneline\" if you just type an \"o\" after --pretty=\n> \n> so, not only \n> \n> git log --pretty=oneline\n> \n> but also\n> \n> git log --pretty=online\n> git log --pretty=offline\n> git log --pretty=omfg\n\nOops, that's unexpected.\n\n> and finally (just to make it short *G*)\n> \n> git log --pretty=osolomio\n> \n> does trigger the oneline-feature. Perhaps this is not intended to work\n> as it works now. I would recommend, that the switch should only accept\n> the fully matched keyword and not just a lowercase \"o\" as the first\n> letter of the keywords following after --pretty=, just to prevent people \n> getting bad habbits.\n\nNo.  The abbreviations are intentional.  It's anything but a bad habit.\n\n--pretty=o\n--pretty=on\n--pretty=one\n--pretty=onel\n--pretty=oneli\n--pretty=onelin\n--pretty=oneline\n\nare all valid abbreviations. I'm a lazy git :)\n\nI also intend to resurrect gitopt in some form in the near future...\n\nFrom: Eric Wong <normalperson@yhbt.net>\nDate: Fri, 2 Feb 2007 05:10:25 -0800\nSubject: [PATCH] Disallow invalid --pretty= abbreviations\n\n--pretty=o is a valid abbreviation, --pretty=omfg is not\n\nNoticed by: Nicolas Vilz\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n commit.c |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/commit.c b/commit.c\nindex 9b2b842..3e8c872 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -47,7 +47,8 @@ enum cmit_fmt get_commit_format(const char *arg)\n \tif (*arg == '=')\n \t\targ++;\n \tfor (i = 0; i < ARRAY_SIZE(cmt_fmts); i++) {\n-\t\tif (!strncmp(arg, cmt_fmts[i].n, cmt_fmts[i].cmp_len))\n+\t\tif (!strncmp(arg, cmt_fmts[i].n, cmt_fmts[i].cmp_len) &&\n+\t\t    !strncmp(arg, cmt_fmts[i].n, strlen(arg)))\n \t\t\treturn cmt_fmts[i].v;\n \t}\n \n-- \nEric Wong\n"}]}