Cornelius Weig <[email protected]> writes:
> And again, thanks for not yelling. I overlooked that the
> "should_autocreate_reflog" return value should have been negated as
> shown below.
Heh---I AM blind. I didn't spot it even though I was staring at the
code and even tweaking it (for the constness thing).
> Should I resend this patch, or is it easier for you
> to do the change yourself?
I can squash it in, now we have and the list saw all the bits
necessary.
Thanks for working on this.
> Interdiff v2..v3:
> diff --git a/builtin/checkout.c b/builtin/checkout.c
> index 81ea2ed..1e8631a 100644
> --- a/builtin/checkout.c
> +++ b/builtin/checkout.c
> @@ -612,8 +612,10 @@ static void update_refs_for_switch(const struct
> checkout_opts *opts,
> const char *old_desc, *reflog_msg;
> if (opts->new_branch) {
> if (opts->new_orphan_branch) {
> - const char *refname = mkpathdup("refs/heads/%s",
> opts->new_orphan_branch);
> - if (opts->new_branch_log &&
> should_autocreate_reflog(refname)) {
> + char *refname;
> +
> + refname = mkpathdup("refs/heads/%s",
> opts->new_orphan_branch);
> + if (opts->new_branch_log &&
> !should_autocreate_reflog(refname)) {
> int ret;
> struct strbuf err = STRBUF_INIT;
>
> @@ -622,6 +624,7 @@ static void update_refs_for_switch(const struct
> checkout_opts *opts,
> fprintf(stderr, _("Can not do reflog
> for '%s': %s\n"),
> opts->new_orphan_branch,
> err.buf);
> strbuf_release(&err);
> + free(refname);
> return;
> }
> strbuf_release(&err);