On Sat, Nov 18, 2017 at 12:26 PM, Kaartic Sivaraam
<kaartic.sivar...@gmail.com> 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 check for the result of verification here as
> it's (almost) always the case that the string does start
> with "refs/heads", it's just better to avoid hard-coding and
> be more communicative.
>
> Signed-off-by: Kaartic Sivaraam <kaartic.sivar...@gmail.com>
> ---
> 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 oldref = STRBUF_INIT, newref = STRBUF_INIT, logmsg = 
> STRBUF_INIT;
>         struct strbuf oldsection = STRBUF_INIT, newsection = STRBUF_INIT;
> +       const char *prefix_free_oldref = NULL;
> +       const char *prefix_free_newref = NULL;

A bit of a mouthful. Perhaps name these 'oldname' and 'newname' or something?

Reply via email to