Re: [PATCH 04/16] refactor skip_prefix to return a boolean

2014-06-23 Thread Jeff King
On Mon, Jun 23, 2014 at 11:50:06AM -0700, Junio C Hamano wrote: > I was re-reading this and noticed another possible bug. > > builtin/clone.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/builtin/clone.c b/builtin/clone.c > index b12989d..df659dd 100644 > --- a/builti

Re: [PATCH 04/16] refactor skip_prefix to return a boolean

2014-06-23 Thread Junio C Hamano
Jeff King writes: > diff --git a/builtin/clone.c b/builtin/clone.c > index b12989d..a5b2d9d 100644 > --- a/builtin/clone.c > +++ b/builtin/clone.c > @@ -703,9 +703,12 @@ static void write_refspec_config(const char* > src_ref_prefix, > strbuf_addf(&value, "+%

Re: [PATCH 04/16] refactor skip_prefix to return a boolean

2014-06-19 Thread Jeff King
On Thu, Jun 19, 2014 at 10:30:36PM -0400, Eric Sunshine wrote: > > diff --git a/git-compat-util.h b/git-compat-util.h > > index 556c839..1187e1a 100644 > > --- a/git-compat-util.h > > +++ b/git-compat-util.h > > @@ -350,8 +350,9 @@ extern int starts_with(const char *str, const char > > *prefix);

Re: [PATCH 04/16] refactor skip_prefix to return a boolean

2014-06-19 Thread Eric Sunshine
On Thu, Jun 19, 2014 at 10:08 PM, Jeff King wrote: > On Thu, Jun 19, 2014 at 09:59:39PM -0400, Eric Sunshine wrote: > >> > diff --git a/git-compat-util.h b/git-compat-util.h >> > index b6f03b3..556c839 100644 >> > --- a/git-compat-util.h >> > +++ b/git-compat-util.h >> > @@ -349,13 +349,31 @@ exte

Re: [PATCH 04/16] refactor skip_prefix to return a boolean

2014-06-19 Thread Jeff King
On Thu, Jun 19, 2014 at 09:59:39PM -0400, Eric Sunshine wrote: > > diff --git a/git-compat-util.h b/git-compat-util.h > > index b6f03b3..556c839 100644 > > --- a/git-compat-util.h > > +++ b/git-compat-util.h > > @@ -349,13 +349,31 @@ extern void set_die_is_recursing_routine(int > > (*routine)(voi

Re: [PATCH 04/16] refactor skip_prefix to return a boolean

2014-06-19 Thread Eric Sunshine
On Wed, Jun 18, 2014 at 3:44 PM, Jeff King wrote: > The skip_prefix function returns a pointer to the content > past the prefix, or NULL if the prefix was not found. While > this is nice and simple, in practice it makes it hard to use > for two reasons: > > 1. When you want to conditionally skip

[PATCH 04/16] refactor skip_prefix to return a boolean

2014-06-18 Thread Jeff King
The skip_prefix function returns a pointer to the content past the prefix, or NULL if the prefix was not found. While this is nice and simple, in practice it makes it hard to use for two reasons: 1. When you want to conditionally skip or keep the string as-is, you have to introduce a second