Re: [PATCH v6 2/6] Add git_env_ulong() to parse environment variable

2014-08-28 Thread Steffen Prohaska
On Aug 27, 2014, at 4:47 PM, Junio C Hamano gits...@pobox.com wrote: Jeff King p...@peff.net writes: On Tue, Aug 26, 2014 at 02:54:11PM -0700, Junio C Hamano wrote: A worse position is to have git_env_bool() that says empty is false and add a new git_env_ulong() that says empty is unset.

Re: [PATCH v6 2/6] Add git_env_ulong() to parse environment variable

2014-08-28 Thread Junio C Hamano
Steffen Prohaska proha...@zib.de writes: OK, then let's do that at least for now and move on. Ok. I saw that you tweaked my patch on pu. Maybe remove the outdated comment above the function completely: diff --git a/config.c b/config.c index 87db755..010bcd0 100644 --- a/config.c +++

Re: [PATCH v6 2/6] Add git_env_ulong() to parse environment variable

2014-08-27 Thread Junio C Hamano
Jeff King p...@peff.net writes: On Tue, Aug 26, 2014 at 02:54:11PM -0700, Junio C Hamano wrote: A worse position is to have git_env_bool() that says empty is false and add a new git_env_ulong() that says empty is unset. We should pick one or the other and use it for both. Yeah, I agree

[PATCH v6 2/6] Add git_env_ulong() to parse environment variable

2014-08-26 Thread Steffen Prohaska
The new function will be used to parse GIT_MMAP_LIMIT and GIT_ALLOC_LIMIT. Signed-off-by: Steffen Prohaska proha...@zib.de --- cache.h | 1 + config.c | 11 +++ 2 files changed, 12 insertions(+) diff --git a/cache.h b/cache.h index fcb511d..b820b6a 100644 --- a/cache.h +++ b/cache.h

Re: [PATCH v6 2/6] Add git_env_ulong() to parse environment variable

2014-08-26 Thread Jeff King
On Tue, Aug 26, 2014 at 05:23:21PM +0200, Steffen Prohaska wrote: +/* + * Use default if environment variable is unset or empty string. + */ +unsigned long git_env_ulong(const char *k, unsigned long val) +{ + const char *v = getenv(k); + if (v *v !git_parse_ulong(v, val)) +

Re: [PATCH v6 2/6] Add git_env_ulong() to parse environment variable

2014-08-26 Thread Junio C Hamano
Jeff King p...@peff.net writes: On Tue, Aug 26, 2014 at 05:23:21PM +0200, Steffen Prohaska wrote: +/* + * Use default if environment variable is unset or empty string. + */ +unsigned long git_env_ulong(const char *k, unsigned long val) +{ +const char *v = getenv(k); +if (v *v

Re: [PATCH v6 2/6] Add git_env_ulong() to parse environment variable

2014-08-26 Thread Jeff King
On Tue, Aug 26, 2014 at 01:20:53PM -0700, Junio C Hamano wrote: I think different people have different confusion criteria. To me, these two are very different operations: $ VAR= $ unset VAR I think it boils down to that I see that the distance between unset vs set to empty is

Re: [PATCH v6 2/6] Add git_env_ulong() to parse environment variable

2014-08-26 Thread Junio C Hamano
Jeff King p...@peff.net writes: If it is truly some people prefer it one way and some the other, I am not sure if we should leave it as-is (that is preferring one way). A worse position is to have git_env_bool() that says empty is false and add a new git_env_ulong() that says empty is unset.

Re: [PATCH v6 2/6] Add git_env_ulong() to parse environment variable

2014-08-26 Thread Jeff King
On Tue, Aug 26, 2014 at 02:54:11PM -0700, Junio C Hamano wrote: A worse position is to have git_env_bool() that says empty is false and add a new git_env_ulong() that says empty is unset. We should pick one or the other and use it for both. Yeah, I agree they should probably behave the