* [RFC/PATCH] Make “git tag --contains <id>” less chatty if <id> is invalid (gsoc)
[not found] ` <CY1PR19MB0128EB66B1C7FA67E601E3DEF2340@CY1PR19MB0128.namprd19.prod.outlook.com>
@ 2017-03-30 21:25 ` Varun Garg
0 siblings, 0 replies; only message in thread
From: Varun Garg @ 2017-03-30 21:25 UTC (permalink / raw)
To: gitster@pobox.com, git@vger.kernel.org
Hi Git devs,
I am a student interested for Gsoc. With my patch I am able to produce following output.
$ git tag --contains qq
error: malformed object name qq
$ git tag --contains HEAD qq
fatal: --contains option is only allowed with -l.
$ git tag --contains 5c5c16af33f3cba2f7ce905514c04c4e173b11dc
error: no such commit 5c5c16af33f3cba2f7ce905514c04c4e173b11dc
$ git rev-parse --verify qq
fatal: Needed a single revision
This makes git less chatty, and solves the problem with https://public-inbox.org/git/20160323224113.GB12531@sigill.intra.peff.net/.
Here is the patch
$cat less_chatty.patch
diff --git a/parse-options.c b/parse-options.c
index a23a1e67f..603c77c61 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -160,7 +160,7 @@ static int get_value(struct parse_opt_ctx_t *p,
return (*opt->callback)(opt, NULL, 0) ? (-1) : 0;
if (get_arg(p, opt, flags, &arg))
return -1;
- return (*opt->callback)(opt, arg, 0) ? (-1) : 0;
+ return (*opt->callback)(opt, arg, 0) ? (-3) : 0;
case OPTION_INTEGER:
if (unset) {
@@ -506,6 +506,8 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
goto show_usage_error;
case -2:
goto unknown;
+ case -3:
+ return PARSE_OPT_HELP;
}
continue;
unknown:
What 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.
However, when I run the tests, I get following behavior with cherry picking,
$ ./t3502-cherry-pick-merge.sh
ok 1 - setup
not ok 2 - cherry-pick -m complains of bogus numbers
#
# # expect 129 here to distinguish between cases where
# # there was nothing to cherry-pick
# test_expect_code 129 git cherry-pick -m &&
# test_expect_code 129 git cherry-pick -m foo b &&
# test_expect_code 129 git cherry-pick -m -1 b &&
# test_expect_code 129 git cherry-pick -m 0 b
#
ok 3 - cherry-pick a non-merge with -m should fail
I 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.
Regards
Varun garg
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-03-30 21:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CY1PR19MB01287042E66B0DA09D554513F2340@CY1PR19MB0128.namprd19.prod.outlook.com>
[not found] ` <CY1PR19MB0128EB66B1C7FA67E601E3DEF2340@CY1PR19MB0128.namprd19.prod.outlook.com>
2017-03-30 21:25 ` [RFC/PATCH] Make “git tag --contains <id>” less chatty if <id> is invalid (gsoc) Varun Garg
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).