Re: [PATCH 02/12] Convert starts_with() to skip_prefix() for option parsing

2013-12-28 Thread Jeff King
On Thu, Dec 26, 2013 at 11:27:10AM -0800, Junio C Hamano wrote: I still need consensus on the name here guys, parse_prefix. remove_prefix or strip_prefix? If no other opinions i'll go with strip_prefix (Jeff's comment before parse_prefix() also uses strip) Yup, that comment is where I

Re: [PATCH 02/12] Convert starts_with() to skip_prefix() for option parsing

2013-12-26 Thread Junio C Hamano
Duy Nguyen pclo...@gmail.com writes: On Sat, Dec 21, 2013 at 4:31 AM, Junio C Hamano gits...@pobox.com wrote: Jeff King p...@peff.net writes: /* here we care if we saw the prefix, as above */ if (parse_prefix(foo, prefix, the_rest)) ... /* * and here we do not care, and

Re: [PATCH 02/12] Convert starts_with() to skip_prefix() for option parsing

2013-12-20 Thread Christian Couder
On Fri, Dec 20, 2013 at 8:04 AM, Jeff King p...@peff.net wrote: On Fri, Dec 20, 2013 at 07:51:00AM +0100, Johannes Sixt wrote: for (i = 1; i argc *argv[i] == '-'; i++) { const char *arg = argv[i]; + const char *optarg; - if (starts_with(arg,

Re: [PATCH 02/12] Convert starts_with() to skip_prefix() for option parsing

2013-12-20 Thread René Scharfe
Am 20.12.2013 08:04, schrieb Jeff King: On Fri, Dec 20, 2013 at 07:51:00AM +0100, Johannes Sixt wrote: for (i = 1; i argc *argv[i] == '-'; i++) { const char *arg = argv[i]; + const char *optarg; - if (starts_with(arg, --upload-pack=)) { -

Re: [PATCH 02/12] Convert starts_with() to skip_prefix() for option parsing

2013-12-20 Thread Junio C Hamano
Jeff King p...@peff.net writes: /* here we care if we saw the prefix, as above */ if (parse_prefix(foo, prefix, the_rest)) ... /* * and here we do not care, and just want to optionally strip the * prefix, and take the full value otherwise; we just have to ignore * the

Re: [PATCH 02/12] Convert starts_with() to skip_prefix() for option parsing

2013-12-20 Thread Duy Nguyen
On Sat, Dec 21, 2013 at 4:31 AM, Junio C Hamano gits...@pobox.com wrote: Jeff King p...@peff.net writes: /* here we care if we saw the prefix, as above */ if (parse_prefix(foo, prefix, the_rest)) ... /* * and here we do not care, and just want to optionally strip the *

Re: [PATCH 02/12] Convert starts_with() to skip_prefix() for option parsing

2013-12-19 Thread Johannes Sixt
Am 12/18/2013 15:53, schrieb Nguyễn Thái Ngọc Duy: The code that's not converted to use parse_options() often does if (!starts_with(arg, foo=)) { value = atoi(arg + 4); } This patch removes those magic numbers with skip_prefix() Signed-off-by: Nguyễn Thái Ngọc Duy

Re: [PATCH 02/12] Convert starts_with() to skip_prefix() for option parsing

2013-12-19 Thread Jeff King
On Fri, Dec 20, 2013 at 07:51:00AM +0100, Johannes Sixt wrote: for (i = 1; i argc *argv[i] == '-'; i++) { const char *arg = argv[i]; + const char *optarg; - if (starts_with(arg, --upload-pack=)) { - args.uploadpack = arg + 14;