{"thread":{"id":"37407","subject":"[PATCH 0/2] describe: support the syntax \"--abbrev=+\"","startedAt":"2014-08-23T17:13:20Z","lastAt":"2014-08-26T18:04:31Z","messageCount":6,"participants":["Jonh Wendell","brian m. carlson"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"248189","messageId":"1408814002-6553-1-git-send-email-jonh.wendell@gmail.com","threadId":"37407","inReplyTo":null,"subject":"[PATCH 0/2] describe: support the syntax \"--abbrev=+\"","fromName":"Jonh Wendell","fromEmail":"jonh.wendell@gmail.com","sentAt":"2014-08-23T17:13:20Z","receivedAt":"2014-08-23T17:13:20Z","isPatch":true,"sender":{"key":"jonh.wendell@gmail.com","avatar":"https://gravatar.com/avatar/9f343d0de3c38bc408ce71f2b42077877daeae03a12037272e02b7da60068aea?d=mp&s=160"},"body":"Sometimes it's interesting to have a simple output that answers the question:\nAre there commits after the latest tag?\n\nOne possible solution is to just print a \"+\" (plus) signal after the tag. Example:\n\n> git describe --abbrev=1 5261ec5d5\nv2.1.0-rc1-2-g5261ec\n\n> git describe --abbrev=+ 5261ec5d5\nv2.1.0-rc1+\n\n\nJonh Wendell (2):\n  describe: support the syntax \"--abbrev=+\"\n  describe: Add documentation for \"--abbrev=+\"\n\n Documentation/git-describe.txt |  6 ++++++\n builtin/describe.c             | 26 +++++++++++++++++++++-----\n 2 files changed, 27 insertions(+), 5 deletions(-)\n\n-- \n1.9.3\n"},{"id":"248191","messageId":"1408814002-6553-2-git-send-email-jonh.wendell@gmail.com","threadId":"37407","inReplyTo":"1408814002-6553-1-git-send-email-jonh.wendell@gmail.com","subject":"[PATCH 1/2] describe: support the syntax \"--abbrev=+\"","fromName":"Jonh Wendell","fromEmail":"jonh.wendell@gmail.com","sentAt":"2014-08-23T17:13:21Z","receivedAt":"2014-08-23T17:13:21Z","isPatch":true,"sender":{"key":"jonh.wendell@gmail.com","avatar":"https://gravatar.com/avatar/9f343d0de3c38bc408ce71f2b42077877daeae03a12037272e02b7da60068aea?d=mp&s=160"},"body":"It will print just a \"+\" sign appended to the found tag, if there\nare commits between the tag and the supplied commit.\n\nIt's useful when you just need a simple output to know if the\nsupplied commit is an exact match or not.\n---\n builtin/describe.c | 26 +++++++++++++++++++++-----\n 1 file changed, 21 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex ee6a3b9..3a5c052 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -30,6 +30,7 @@ static int have_util;\n static const char *pattern;\n static int always;\n static const char *dirty;\n+static int simple_abbrev = 0;\n \n /* diff-index command arguments to check if working tree is dirty. */\n static const char *diff_index_args[] = {\n@@ -378,8 +379,12 @@ static void describe(const char *arg, int last_one)\n \t}\n \n \tdisplay_name(all_matches[0].name);\n-\tif (abbrev)\n-\t\tshow_suffix(all_matches[0].depth, cmit->object.sha1);\n+\tif (abbrev) {\n+\t\tif (simple_abbrev)\n+\t\t\tprintf(\"+\");\n+\t\telse\n+\t\t\tshow_suffix(all_matches[0].depth, cmit->object.sha1);\n+\t}\n \tif (dirty)\n \t\tprintf(\"%s\", dirty);\n \tprintf(\"\\n\");\n@@ -388,6 +393,16 @@ static void describe(const char *arg, int last_one)\n \t\tclear_commit_marks(cmit, -1);\n }\n \n+static int parse_opt_abbrev_for_describe_cb(const struct option *opt, const char *arg, int unset)\n+{\n+\tif (arg && !strncmp(arg, \"+\", 1)) {\n+\t\tsimple_abbrev = 1;\n+\t\treturn 0;\n+\t}\n+\n+\treturn parse_opt_abbrev_cb(opt, arg, unset);\n+}\n+\n int cmd_describe(int argc, const char **argv, const char *prefix)\n {\n \tint contains = 0;\n@@ -398,7 +413,6 @@ int cmd_describe(int argc, const char **argv, const char *prefix)\n \t\tOPT_BOOL(0, \"tags\",       &tags, N_(\"use any tag, even unannotated\")),\n \t\tOPT_BOOL(0, \"long\",       &longformat, N_(\"always use long format\")),\n \t\tOPT_BOOL(0, \"first-parent\", &first_parent, N_(\"only follow first parent\")),\n-\t\tOPT__ABBREV(&abbrev),\n \t\tOPT_SET_INT(0, \"exact-match\", &max_candidates,\n \t\t\t    N_(\"only output exact matches\"), 0),\n \t\tOPT_INTEGER(0, \"candidates\", &max_candidates,\n@@ -410,6 +424,8 @@ int cmd_describe(int argc, const char **argv, const char *prefix)\n \t\t{OPTION_STRING, 0, \"dirty\",  &dirty, N_(\"mark\"),\n \t\t\tN_(\"append <mark> on dirty working tree (default: \\\"-dirty\\\")\"),\n \t\t\tPARSE_OPT_OPTARG, NULL, (intptr_t) \"-dirty\"},\n+\t\t{OPTION_CALLBACK, 0, \"abbrev\", &abbrev, N_(\"n\"), N_(\"use <n> digits to display SHA-1s\"),\n+\t\t\tPARSE_OPT_OPTARG, &parse_opt_abbrev_for_describe_cb, 0},\n \t\tOPT_END(),\n \t};\n \n@@ -425,8 +441,8 @@ int cmd_describe(int argc, const char **argv, const char *prefix)\n \n \tsave_commit_buffer = 0;\n \n-\tif (longformat && abbrev == 0)\n-\t\tdie(_(\"--long is incompatible with --abbrev=0\"));\n+\tif (longformat && (abbrev == 0 || simple_abbrev))\n+\t\tdie(_(\"--long is incompatible with --abbrev=+ or --abbrev=0\"));\n \n \tif (contains) {\n \t\tstruct argv_array args;\n-- \n1.9.3\n"},{"id":"248190","messageId":"1408814002-6553-3-git-send-email-jonh.wendell@gmail.com","threadId":"37407","inReplyTo":"1408814002-6553-1-git-send-email-jonh.wendell@gmail.com","subject":"[PATCH 2/2] describe: Add documentation for \"--abbrev=+\"","fromName":"Jonh Wendell","fromEmail":"jonh.wendell@gmail.com","sentAt":"2014-08-23T17:13:22Z","receivedAt":"2014-08-23T17:13:22Z","isPatch":true,"sender":{"key":"jonh.wendell@gmail.com","avatar":"https://gravatar.com/avatar/9f343d0de3c38bc408ce71f2b42077877daeae03a12037272e02b7da60068aea?d=mp&s=160"},"body":"---\n Documentation/git-describe.txt | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/Documentation/git-describe.txt b/Documentation/git-describe.txt\nindex d20ca40..e291770 100644\n--- a/Documentation/git-describe.txt\n+++ b/Documentation/git-describe.txt\n@@ -54,6 +54,12 @@ OPTIONS\n \tabbreviated object name, use <n> digits, or as many digits\n \tas needed to form a unique object name.  An <n> of 0\n \twill suppress long format, only showing the closest tag.\n+\t+\n+\t+\n+\tA special case of <n> equals to \"\\+\" (without quotes) will print\n+\tjust a \"+\" sign instead of the whole suffix. This is useful if you\n+\tonly need to know if the supplied <commit-ish> points to an exact\n+\tmatch or if there are commits between the tag found and the <commit-ish>.\n \n --candidates=<n>::\n \tInstead of considering only the 10 most recent tags as\n-- \n1.9.3\n"},{"id":"248196","messageId":"20140824063536.GB3439@vauxhall.crustytoothpaste.net","threadId":"37407","inReplyTo":"1408814002-6553-3-git-send-email-jonh.wendell@gmail.com","subject":"Re: [PATCH 2/2] describe: Add documentation for \"--abbrev=+\"","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2014-08-24T06:35:38Z","receivedAt":"2014-08-24T06:35:38Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Sat, Aug 23, 2014 at 02:13:22PM -0300, Jonh Wendell wrote:\n> ---\n>  Documentation/git-describe.txt | 6 ++++++\n>  1 file changed, 6 insertions(+)\n> \n> diff --git a/Documentation/git-describe.txt b/Documentation/git-describe.txt\n> index d20ca40..e291770 100644\n> --- a/Documentation/git-describe.txt\n> +++ b/Documentation/git-describe.txt\n> @@ -54,6 +54,12 @@ OPTIONS\n>  \tabbreviated object name, use <n> digits, or as many digits\n>  \tas needed to form a unique object name.  An <n> of 0\n>  \twill suppress long format, only showing the closest tag.\n> +\t+\n> +\t+\n\nDid you intend to have two lines with just plus signs here?  I'm not\naware of anywhere else in the Documentation where we do that.\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\n+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187\n"},{"id":"248199","messageId":"CABXqP=iGfrbBrWE8qiavcpEqtPaaR8n2S4=i0+cQ3F6BLH40Cw@mail.gmail.com","threadId":"37407","inReplyTo":"20140824063536.GB3439@vauxhall.crustytoothpaste.net","subject":"Re: [PATCH 2/2] describe: Add documentation for \"--abbrev=+\"","fromName":"Jonh Wendell","fromEmail":"jonh.wendell@gmail.com","sentAt":"2014-08-24T12:11:15Z","receivedAt":"2014-08-24T12:11:15Z","isPatch":true,"sender":{"key":"jonh.wendell@gmail.com","avatar":"https://gravatar.com/avatar/9f343d0de3c38bc408ce71f2b42077877daeae03a12037272e02b7da60068aea?d=mp&s=160"},"body":"2014-08-24 3:35 GMT-03:00 brian m. carlson <sandals@crustytoothpaste.net>:\n> On Sat, Aug 23, 2014 at 02:13:22PM -0300, Jonh Wendell wrote:\n>> ---\n>>  Documentation/git-describe.txt | 6 ++++++\n>>  1 file changed, 6 insertions(+)\n>>\n>> diff --git a/Documentation/git-describe.txt b/Documentation/git-describe.txt\n>> index d20ca40..e291770 100644\n>> --- a/Documentation/git-describe.txt\n>> +++ b/Documentation/git-describe.txt\n>> @@ -54,6 +54,12 @@ OPTIONS\n>>       abbreviated object name, use <n> digits, or as many digits\n>>       as needed to form a unique object name.  An <n> of 0\n>>       will suppress long format, only showing the closest tag.\n>> +     +\n>> +     +\n>\n> Did you intend to have two lines with just plus signs here?  I'm not\n> aware of anywhere else in the Documentation where we do that.\n> --\n\nIn my tests just one line was not enough to produce a proper line\nbreak in the html output.\nWith two lines like above the output in man and html are ok (just 1 line break).\n\n-- \nJonh Wendell\nhttp://www.bani.com.br\n"},{"id":"248334","messageId":"CABXqP=hhc6zXm5x7CpAzP8n2exUPRNOAeg7ENVUL7T=gXGmVcg@mail.gmail.com","threadId":"37407","inReplyTo":"1408814002-6553-1-git-send-email-jonh.wendell@gmail.com","subject":"Re: [PATCH 0/2] describe: support the syntax \"--abbrev=+\"","fromName":"Jonh Wendell","fromEmail":"jonh.wendell@gmail.com","sentAt":"2014-08-26T18:04:31Z","receivedAt":"2014-08-26T18:04:31Z","isPatch":true,"sender":{"key":"jonh.wendell@gmail.com","avatar":"https://gravatar.com/avatar/9f343d0de3c38bc408ce71f2b42077877daeae03a12037272e02b7da60068aea?d=mp&s=160"},"body":"hi there!\njust a ping here, these are my first patches to git.\nany comment, feedback?\n\n2014-08-23 14:13 GMT-03:00 Jonh Wendell <jonh.wendell@gmail.com>:\n> Sometimes it's interesting to have a simple output that answers the question:\n> Are there commits after the latest tag?\n>\n> One possible solution is to just print a \"+\" (plus) signal after the tag. Example:\n>\n>> git describe --abbrev=1 5261ec5d5\n> v2.1.0-rc1-2-g5261ec\n>\n>> git describe --abbrev=+ 5261ec5d5\n> v2.1.0-rc1+\n>\n>\n> Jonh Wendell (2):\n>   describe: support the syntax \"--abbrev=+\"\n>   describe: Add documentation for \"--abbrev=+\"\n>\n>  Documentation/git-describe.txt |  6 ++++++\n>  builtin/describe.c             | 26 +++++++++++++++++++++-----\n>  2 files changed, 27 insertions(+), 5 deletions(-)\n>\n> --\n> 1.9.3\n>\n\n\n\n-- \nJonh Wendell\nhttp://www.bani.com.br\n"}]}