Re: [PATCH 4/4] builtin/branch: strip refs/heads/ using skip_prefix

2017-11-19 Thread Eric Sunshine
On Sun, Nov 19, 2017 at 12:21 PM, Kaartic Sivaraam wrote: > On Sunday 19 November 2017 06:34 AM, Eric Sunshine wrote: >> On Sat, Nov 18, 2017 at 12:26 PM, Kaartic Sivaraam >> wrote: >>> >>> diff --git a/builtin/branch.c b/builtin/branch.c >>> @@ -462,6 +462,8 @@ static void copy_or_rename_branch(

Re: [PATCH 4/4] builtin/branch: strip refs/heads/ using skip_prefix

2017-11-19 Thread Kaartic Sivaraam
On Sunday 19 November 2017 06:34 AM, Eric Sunshine wrote: On Sat, Nov 18, 2017 at 12:26 PM, Kaartic Sivaraam wrote: diff --git a/builtin/branch.c b/builtin/branch.c @@ -462,6 +462,8 @@ static void copy_or_rename_branch(const char *oldname, const char *newname, int { struct strbuf ol

Re: [PATCH 4/4] builtin/branch: strip refs/heads/ using skip_prefix

2017-11-18 Thread Eric Sunshine
On Sat, Nov 18, 2017 at 12:26 PM, Kaartic Sivaraam wrote: > Instead of hard-coding the offset strlen("refs/heads/") to skip > the prefix "refs/heads/" use the skip_prefix() function which > is more communicative and verifies that the string actually > starts with that prefix. > > Though we don't c

[PATCH 4/4] builtin/branch: strip refs/heads/ using skip_prefix

2017-11-18 Thread Kaartic Sivaraam
Instead of hard-coding the offset strlen("refs/heads/") to skip the prefix "refs/heads/" use the skip_prefix() function which is more communicative and verifies that the string actually starts with that prefix. Though we don't check for the result of verification here as it's (almost) always the c