{"thread":{"id":"45556","subject":"[RFC/PATCH] Make “git tag --contains <id>” less chatty if <id> is invalid (gsoc)","startedAt":"2017-03-30T21:26:20Z","lastAt":"2017-03-30T21:26:20Z","messageCount":1,"participants":["Varun Garg"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"315835","messageId":"CY1PR19MB01289DCA6C08CDC9F07C6D7DF2340@CY1PR19MB0128.namprd19.prod.outlook.com","threadId":"45556","inReplyTo":"CY1PR19MB0128EB66B1C7FA67E601E3DEF2340@CY1PR19MB0128.namprd19.prod.outlook.com","subject":"[RFC/PATCH] Make “git tag --contains <id>” less chatty if <id> is invalid (gsoc)","fromName":"Varun Garg","fromEmail":"varun.10@live.com","sentAt":"2017-03-30T21:25:58Z","receivedAt":"2017-03-30T21:26:20Z","isPatch":true,"sender":{"key":"varun.10@live.com","avatar":null},"body":"Hi Git devs,\n\nI am a student interested for Gsoc. With my patch I am able to produce following output.\n\n    $ git tag --contains qq\n    error: malformed object name qq\n\n    $ git tag --contains HEAD qq\n    fatal: --contains option is only allowed with -l.\n\n    $ git tag --contains 5c5c16af33f3cba2f7ce905514c04c4e173b11dc\n    error: no such commit 5c5c16af33f3cba2f7ce905514c04c4e173b11dc\n\n    $ git rev-parse --verify qq\n    fatal: Needed a single revision\n\nThis makes git less chatty, and solves the problem with  https://public-inbox.org/git/20160323224113.GB12531@sigill.intra.peff.net/.\n\nHere is the patch\n\n$cat less_chatty.patch \ndiff --git a/parse-options.c b/parse-options.c\nindex a23a1e67f..603c77c61 100644\n--- a/parse-options.c\n+++ b/parse-options.c\n@@ -160,7 +160,7 @@ static int get_value(struct parse_opt_ctx_t *p,\n             return (*opt->callback)(opt, NULL, 0) ? (-1) : 0;\n         if (get_arg(p, opt, flags, &arg))\n             return -1;\n-        return (*opt->callback)(opt, arg, 0) ? (-1) : 0;\n+        return (*opt->callback)(opt, arg, 0) ? (-3) : 0;\n \n     case OPTION_INTEGER:\n         if (unset) {\n@@ -506,6 +506,8 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,\n             goto show_usage_error;\n         case -2:\n             goto unknown;\n+                case -3:\n+                        return PARSE_OPT_HELP;\n         }\n         continue;\n unknown:\n\nWhat I have done is, created a new case(-3) which is error but not to be displayed. In case 1, function usage_with_options_internal() is called which returns PARSE_OPT_HELP (and doesen't modify given parameters). So directly returning it from 3rd case should directly skip help text without affecting program behavior. This gave me the desired results.\n\nHowever, when I run the tests, I get following behavior with cherry picking,\n\n\n$ ./t3502-cherry-pick-merge.sh \nok 1 - setup\nnot ok 2 - cherry-pick -m complains of bogus numbers\n#    \n#        # expect 129 here to distinguish between cases where\n#        # there was nothing to cherry-pick\n#        test_expect_code 129 git cherry-pick -m &&\n#        test_expect_code 129 git cherry-pick -m foo b &&\n#        test_expect_code 129 git cherry-pick -m -1 b &&\n#        test_expect_code 129 git cherry-pick -m 0 b\n#    \nok 3 - cherry-pick a non-merge with -m should fail\n\nI have no idea where and why it is coming. (maybe it wants a more chatty git). Any help would be really appreciated since gsoc deadline is very close and I have to write a proposal.\n\nRegards\nVarun garg\n"}]}