git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
	"git\@vger.kernel.org" <git@vger.kernel.org>,
	Jens Lehmann <Jens.Lehmann@web.de>
Subject: Re: [PATCHv9 3/6] fetching submodules: respect `submodule.fetchJobs` config option
Date: Tue, 09 Feb 2016 18:04:45 -0800	[thread overview]
Message-ID: <xmqqtwlhz5fm.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <xmqqy4atz7u0.fsf@gitster.mtv.corp.google.com> (Junio C. Hamano's message of "Tue, 09 Feb 2016 17:12:55 -0800")

Junio C Hamano <gitster@pobox.com> writes:

> I actually do not think we mind git_parse_int(), git_parse_long(),
> and git_parse_uint() to complement git_parse_ulong().  I am not
> enthused by the "nonnegative-int" thing, though.
>
> Do we have enough cases where we want to use signed type and reserve
> negative value for our own internal use (e.g. "unspecified yet")?
> If not, a very generic git_config_int() with a caller specific range
> check wouldn't look _so_ bad.
>
> 	parallel_jobs = git_config_int(var, val);
>         if (parallel_jobs < 0)
> 	     	some corrective action;
> 	return 0;

And of course, if we _do_ have many callsites where the caller wants
a sub-range of the range allowed by the underlying type, we can have

 	<T> git_config_<T>_bounded(var, val, <T> lb, <T> ub)

where T are the usual integral types and lb and ub are (inclusive)
lower and upper bounds.  With that, Jonathan's non-negative-int
would fall out as a natural consequence:

	parallel_jobs = git_config_int_bounded(var, val, 0, INT_MAX);

I vaguely recall that Michael Haggerty had a series to add and use
helpers to parse values of integral types and something like that
interface was suggested in the discussion; and it may even have used
a word better than "bounded".

  reply	other threads:[~2016-02-10  2:04 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-09 20:54 [PATCHv9 0/6] Expose submodule parallelism to the user Stefan Beller
2016-02-09 20:54 ` [PATCHv9 1/6] submodule-config: keep update strategy around Stefan Beller
2016-02-09 21:08   ` Junio C Hamano
2016-02-09 22:19     ` Stefan Beller
2016-02-09 22:29       ` Junio C Hamano
2016-02-09 21:49   ` Jonathan Nieder
2016-02-09 22:32   ` Junio C Hamano
2016-02-11 20:00     ` Junio C Hamano
2016-02-09 20:54 ` [PATCHv9 2/6] submodule-config: drop check against NULL Stefan Beller
2016-02-09 21:50   ` Jonathan Nieder
2016-02-09 20:54 ` [PATCHv9 3/6] fetching submodules: respect `submodule.fetchJobs` config option Stefan Beller
2016-02-09 21:12   ` Junio C Hamano
2016-02-09 22:34   ` Jonathan Nieder
2016-02-10  0:11     ` Stefan Beller
2016-02-10  1:12       ` Junio C Hamano
2016-02-10  2:04         ` Junio C Hamano [this message]
2016-02-09 20:54 ` [PATCHv9 4/6] git submodule update: have a dedicated helper for cloning Stefan Beller
2016-02-09 21:24   ` Junio C Hamano
2016-02-10  0:37   ` Jonathan Nieder
2016-02-10  2:26   ` Jacob Keller
2016-02-10 17:49     ` Stefan Beller
2016-02-11  7:46       ` Jacob Keller
2016-02-09 20:54 ` [PATCHv9 5/6] submodule update: expose parallelism to the user Stefan Beller
2016-02-09 20:54 ` [PATCHv9 6/6] clone: allow an explicit argument for parallel submodule clones Stefan Beller
2016-02-09 21:39 ` [PATCHv9 0/6] Expose submodule parallelism to the user Junio C Hamano
2016-02-09 21:46   ` Stefan Beller
2016-02-09 22:03     ` Junio C Hamano
2016-02-11 20:23       ` Junio C Hamano
2016-02-11 20:28         ` Junio C Hamano
2016-02-11 20:33         ` Stefan Beller

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=xmqqtwlhz5fm.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=sbeller@google.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).