From: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>
To: Tanay Abhra <tanayabh@gmail•com>
Cc: git@vger•kernel.org, Ramkumar Ramachandra <artagnon@gmail•com>
Subject: Re: [PATCH 1/4] fast-import.c: replace `git_config()` with `git_config_get_*()` family
Date: Wed, 13 Aug 2014 13:24:05 +0200 [thread overview]
Message-ID: <vpqppg4vdii.fsf@anie.imag.fr> (raw)
In-Reply-To: <1407918122-29973-1-git-send-email-tanayabh@gmail.com> (Tanay Abhra's message of "Wed, 13 Aug 2014 01:21:59 -0700")
Tanay Abhra <tanayabh@gmail•com> writes:
> fast-import.c | 42 +++++++++++++++++++-----------------------
> 1 file changed, 19 insertions(+), 23 deletions(-)
Only 4 lines less, how disappointing ;-).
More seriously, the old code was essentially dealing with special
values, which your new code needs to do too, so you can hardly do any
less.
> + if (!git_config_get_int("pack.compression", &pack_compression_level)) {
> + if (pack_compression_level == -1)
> + pack_compression_level = Z_DEFAULT_COMPRESSION;
> + else if (pack_compression_level < 0 ||
> + pack_compression_level > Z_BEST_COMPRESSION)
> + die("bad pack compression level %d", pack_compression_level);
That would be a good use for git_die_config(), to give a better error
message, right?
> - if (!strcmp(k, "pack.indexversion")) {
> - pack_idx_opts.version = git_config_int(k, v);
> + if (!git_config_get_int("pack.indexversion", &indexversion_value)) {
> + pack_idx_opts.version = indexversion_value;
I wondered why you were not assigning to pack_idx_opts.version directly,
but pack_idx_opts.version is uint32 and you don't have
config_get_uint32, so it's OK.
> if (pack_idx_opts.version > 2)
> - die("bad pack.indexversion=%"PRIu32,
> - pack_idx_opts.version);
> - return 0;
> + die("bad pack.indexversion=%"PRIu32, pack_idx_opts.version);
One more opportunity for git_die_config()?
Not that it's terribly important, but I think it's good that your
refactoring also brings a few end-users benefits. It will help you show
off when you tell your friends what you did this summer (not "I did
useless code churn" ;-) ), and helps everybody see the benefits of your
GSoC ;-).
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
next prev parent reply other threads:[~2014-08-13 11:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-13 8:21 [PATCH 1/4] fast-import.c: replace `git_config()` with `git_config_get_*()` family Tanay Abhra
2014-08-13 8:22 ` [PATCH 2/4] ll-merge.c: refactor `read_merge_config()` to use `git_config_string()` Tanay Abhra
2014-08-13 11:32 ` Matthieu Moy
2014-08-13 12:43 ` [PATCH v2 " Tanay Abhra
2014-08-13 13:07 ` Matthieu Moy
2014-08-13 17:07 ` Junio C Hamano
2014-08-13 8:22 ` [PATCH 3/4] merge-recursive.c: replace `git_config()` with `git_config_get_int()` Tanay Abhra
2014-08-13 11:34 ` Matthieu Moy
2014-08-13 8:22 ` [PATCH 4/4] builtin/apply.c: replace `git_config()` with `git_config_get_string_const()` Tanay Abhra
2014-08-13 11:24 ` Matthieu Moy [this message]
2014-08-13 12:11 ` [PATCH 1/4] fast-import.c: replace `git_config()` with `git_config_get_*()` family Tanay Abhra
2014-08-13 12:22 ` [PATCH v2 1/5] " Tanay Abhra
2014-08-13 13:10 ` Matthieu Moy
2014-08-13 13:33 ` [PATCH/RFC v2 1/2] git_default_config() rewritten using the config-set API Tanay Abhra
2014-08-13 13:39 ` [PATCH/RFC v2 2/2] use the new git_default_config() Tanay Abhra
2014-08-13 16:00 ` [PATCH/RFC v2 1/2] git_default_config() rewritten using the config-set API Matthieu Moy
2014-08-13 17:18 ` Junio C Hamano
2014-08-13 16:16 ` Matthieu Moy
2014-08-13 17:14 ` [PATCH 1/4] fast-import.c: replace `git_config()` with `git_config_get_*()` family Junio C Hamano
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=vpqppg4vdii.fsf@anie.imag.fr \
--to=matthieu.moy@grenoble-inp$(echo .)fr \
--cc=artagnon@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=tanayabh@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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