From: Michael J Gruber <git@drmicha.warpmail.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>
Subject: Re: [PATCH 1/2] config: define and document exit codes
Date: Wed, 18 May 2011 20:49:10 +0200 [thread overview]
Message-ID: <4DD414A6.2060807@drmicha.warpmail.net> (raw)
In-Reply-To: <7vfwocc8z5.fsf@alter.siamese.dyndns.org>
Junio C Hamano venit, vidit, dixit 18.05.2011 17:41:
> Michael J Gruber <git@drmicha.warpmail.net> writes:
>
>> +This command will fail (with exit code ret) if:
>> +
>> +. The config file is invalid (ret=3),
>> +. can not write to the config file (ret=4),
>> +. no section or name was provided (ret=2),
>> +. the section or key is invalid (ret=1),
>> +. you try to unset an option which does not exist (ret=5),
>> +. you try to unset/set an option for which multiple lines match (ret=5),
>> +. you try to use an invalid regexp (ret=6), or
>> +. you use '--global' option without $HOME being properly set (ret=128).
>
> I wonder if you want to sort this in the order of return codes.
Well, if I wanted to... ;)
I don't mind resorting.
>> +/* git_config_parse_key() returns these negated: */
>> +#define CONFIG_INVALID_KEY 1
>> +#define CONFIG_NO_SECTION_OR_NAME 2
>> +/* git_config_set(), git_config_set_multivar() return the above or these: */
>> +#define CONFIG_NO_LOCK -1
>> +#define CONFIG_INVALID_FILE 3
>> +#define CONFIG_NO_WRITE 4
>> +#define CONFIG_NOTHING_SET 5
>> +#define CONFIG_INVALID_PATTERN 6
>
> Symbols "CONFIG_FOO" looks too much like they are about the feature set
> chosen when compiling git, at least to me. But I do not think of a better
> naming scheme ("CONFIG_ERR_FOO" may be a slight improvement but not good
> enough improvement for the price we pay by having such long symbol names).
Well, we could do CONFIG_ENOLOCK and such. I didn't find a good sample
to follow. Thinking more about it, using CONFIG_ENOPARSE would be nice,
though I can't decide between 1, 2 or 3 for that...
> By the way, Are you still interested in "diff --stat-count" topic, or have
> you abandoned it?
Yes. I've reworked it a bit but there are three goals:
- count right
- determine the correct maximal file name length
- don't sacrifice efficiency
The middle one is problematic even before my patch (that first loop does
not drop all items that the latter one drops).
Maybe the third one is no real problem so that I could simply go through
the list twice.
Oh, and I've checked that fmt-merge-msg does this:
- output at most <count> items
- if there are more, output "..."
So, there's progress, though not visible yet.
Michael
prev parent reply other threads:[~2011-05-18 18:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-17 11:34 [PATCH/RFC] config: Give error message when not changing a multivar Michael J Gruber
2011-05-17 12:38 ` Jeff King
2011-05-17 14:03 ` Michael J Gruber
2011-05-17 14:07 ` Jeff King
2011-05-17 15:38 ` [PATCH 1/2] config: define and document exit codes Michael J Gruber
2011-05-17 15:38 ` [PATCH 2/2] config: Give error message when not changing a multivar Michael J Gruber
2011-05-17 15:46 ` [PATCH 1/2] config: define and document exit codes Thiago Farina
2011-05-17 15:49 ` Michael J Gruber
2011-05-18 8:21 ` Jeff King
2011-05-18 15:41 ` Junio C Hamano
2011-05-18 18:49 ` Michael J Gruber [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4DD414A6.2060807@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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.
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 NNTP newsgroup(s).