From: Varun Garg <varun.10@live.com>
To: "gitster@pobox.com" <gitster@pobox.com>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: [RFC/PATCH] Make “git tag --contains <id>” less chatty if <id> is invalid (gsoc)
Date: Thu, 30 Mar 2017 21:25:58 +0000 [thread overview]
Message-ID: <CY1PR19MB01289DCA6C08CDC9F07C6D7DF2340@CY1PR19MB0128.namprd19.prod.outlook.com> (raw)
In-Reply-To: <CY1PR19MB0128EB66B1C7FA67E601E3DEF2340@CY1PR19MB0128.namprd19.prod.outlook.com>
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
parent reply other threads:[~2017-03-30 21:26 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <CY1PR19MB0128EB66B1C7FA67E601E3DEF2340@CY1PR19MB0128.namprd19.prod.outlook.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CY1PR19MB01289DCA6C08CDC9F07C6D7DF2340@CY1PR19MB0128.namprd19.prod.outlook.com \
--to=varun.10@live.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).