Subject: Re: [PATCH 2/4] remote: drop const return of tracking_for_push_dest()

From: Patrick Steinhardt <[email-masked]>
Date: Mon, 19 Jan 2026 07:34:03 +0100

On Mon, Jan 19, 2026 at 12:20:26AM -0500, Jeff King wrote:
> The string returned from tracking_for_push_dest() comes from
> apply_refspec(), and thus is always an allocated string (or NULL). We
> should return a non-const pointer so that the caller knows that
> ownership of the string is being transferred.
> 
> This goes back to the function's origin in e291c75a95 (remote.c: add
> branch_get_push, 2015-05-21). It never really mattered because our
> return is just forwarded through branch_get_push_1(), which returns a
> const string as part of an intentionally hacky memory management scheme
> (see that commit for details).

Okay, so here we can now also return a `char *` now that `error_buf()`
got adapted.

> As the first step of untangling that hackery, let's drop the extra const
> from this helper function (and from the variables that store its
> result). There should be no functional change (yet).

Yup. The memory handling still feels weird, but as in the preceding
commit that's not a fault of this patch series.

Patrick