Re: [PATCH v24 0/7] branch: delete-merged
Junio C Hamano <[email protected]> Tue, 04 Aug 2026 14:04:36 -0700
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <[email protected]> |
Phillip Wood <[email protected]> writes: > As far as I can see, from here ... > >> @@ builtin/branch.c: static int parse_opt_forked(const struct option *opt, const ch >... >> ++ strbuf_release(&key); >> +} > > ... to here pretty much takes us back to V19 with the difference that we > only prune protected branches from the deleteable set after we've > visited all the branches - looks good. > >> +static int branch_pushes_to_upstream(struct branch *branch, >> + const char *upstream) >> +{ >> + struct remote *remote = remote_get(remote_for_branch(branch, NULL)); >> ++ char *push_refname = NULL; >> + char *tracking = NULL; >> + int ret = 0; >> + >> -+ if (remote) >> -+ tracking = apply_refspecs(&remote->fetch, branch->refname); >> ++ if (!remote) >> ++ return 0; >> ++ if (remote->push.nr) >> ++ push_refname = apply_refspecs(&remote->push, branch->refname); >> ++ else >> ++ push_refname = xstrdup(branch->refname); >> ++ if (push_refname) >> ++ tracking = apply_refspecs(&remote->fetch, push_refname); >> + if (tracking && !strcmp(tracking, upstream)) >> + ret = 1; >> ++ free(push_refname);> + free(tracking); >> + return ret; >> +} > > This looks good now - we map the branch name with the push refspec if > there is one and then with the fetch refspec. > > The test changes below look good as well. OK. I'd mark the topic as "expecting a (hopefully small and final) reroll", perhaps. Thanks.