Glen Choo <chooglen@xxxxxxxxxx> writes: > >> @@ -401,7 +410,34 @@ void create_branch(struct repository *r, > >> > >> if ((commit = lookup_commit_reference(r, &oid)) == NULL) > >> die(_("Not a valid branch point: '%s'."), start_name); > >> - oidcpy(&oid, &commit->object.oid); > >> + if (out_real_ref) > >> + *out_real_ref = real_ref ? xstrdup(real_ref) : NULL; > > > > I think you can just write "*out_real_ref = real_ref; real_ref = NULL;" > > here, and then not need to xstrdup. > > Hm, you are right. The xstrdup was added because the original function > calls FREE_AND_NULL(real_ref) and then checks if real_ref is NULL. But > after the refactor, real_ref is not referenced after the > FREE_AND_NULL(real_ref), so that call can be removed. > > I intend to remove the xstrdup, though it will introduce a bit of noise > because that block will no longer be moved wholesale. Ah, thanks for watching out for the diff. I think in this case, we'll be fine, since the xstrdup line is a new line ("xstrdup" only appears once in the diff, here).