<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/remote.c, branch main</title>
<subtitle>Fork of git SCM with my patches.</subtitle>
<id>http://git.kilabit.info/git/atom?h=main</id>
<link rel='self' href='http://git.kilabit.info/git/atom?h=main'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/'/>
<updated>2026-04-01T03:43:14Z</updated>
<entry>
<title>odb: rename `odb_has_object()` flags</title>
<updated>2026-04-01T03:43:14Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-03-31T23:57:50Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=c63911b052dc286de5daddba8d4a20fd59348cee'/>
<id>urn:sha1:c63911b052dc286de5daddba8d4a20fd59348cee</id>
<content type='text'>
Rename `odb_has_object()` flags to be properly prefixed with the
function name.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'hn/status-compare-with-push'</title>
<updated>2026-03-12T21:09:06Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-12T21:09:06Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=d0413b31ddcce6ae6ffaff0a30a67ffbd1a7c648'/>
<id>urn:sha1:d0413b31ddcce6ae6ffaff0a30a67ffbd1a7c648</id>
<content type='text'>
"git status" learned to show comparison between the current branch
and various other branches listed on status.compareBranches
configuration.

* hn/status-compare-with-push:
  status: clarify how status.compareBranches deduplicates
  status: add status.compareBranches config for multiple branch comparisons
  refactor format_branch_comparison in preparation
</content>
</entry>
<entry>
<title>status: add status.compareBranches config for multiple branch comparisons</title>
<updated>2026-02-26T15:25:48Z</updated>
<author>
<name>Harald Nordgren</name>
<email>haraldnordgren@gmail.com</email>
</author>
<published>2026-02-26T10:33:42Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=3ea95ac9c5a8ac60702b157153498453afe7ab3b'/>
<id>urn:sha1:3ea95ac9c5a8ac60702b157153498453afe7ab3b</id>
<content type='text'>
Add a new configuration variable status.compareBranches that allows
users to specify a space-separated list of branch comparisons in
git status output.

Supported values:
- @{upstream} for the current branch's upstream tracking branch
- @{push} for the current branch's push destination

Any other value is ignored and a warning is shown.

When not configured, the default behavior is equivalent to setting
`status.compareBranches = @{upstream}`, preserving backward
compatibility.

The advice messages shown are context-aware:
- "git pull" advice is shown only when comparing against @{upstream}
- "git push" advice is shown only when comparing against @{push}
- Divergence advice is shown for upstream branch comparisons

This is useful for triangular workflows where the upstream tracking
branch differs from the push destination, allowing users to see their
status relative to both branches at once.

Example configuration:
    [status]
        compareBranches = @{upstream} @{push}

Signed-off-by: Harald Nordgren &lt;haraldnordgren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refactor format_branch_comparison in preparation</title>
<updated>2026-02-26T15:25:48Z</updated>
<author>
<name>Harald Nordgren</name>
<email>haraldnordgren@gmail.com</email>
</author>
<published>2026-02-26T10:33:41Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=04f47265c1cfb8dce2287b5fb36ddfaa86a2ac61'/>
<id>urn:sha1:04f47265c1cfb8dce2287b5fb36ddfaa86a2ac61</id>
<content type='text'>
Refactor format_branch_comparison function in preparation for showing
comparison with push remote tracking branch.

Signed-off-by: Harald Nordgren &lt;haraldnordgren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ps/commit-list-functions-renamed'</title>
<updated>2026-02-13T21:39:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-02-13T21:39:25Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=528820243334c55e015047477e720a14bc9cf25f'/>
<id>urn:sha1:528820243334c55e015047477e720a14bc9cf25f</id>
<content type='text'>
Rename three functions around the commit_list data structure.

* ps/commit-list-functions-renamed:
  commit: rename `free_commit_list()` to conform to coding guidelines
  commit: rename `reverse_commit_list()` to conform to coding guidelines
  commit: rename `copy_commit_list()` to conform to coding guidelines
</content>
</entry>
<entry>
<title>Merge branch 'jk/remote-tracking-ref-leakfix'</title>
<updated>2026-02-05T23:41:57Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-02-05T23:41:57Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=2b53e8b3ee7f143af785e2a39ce4e1614ff6c66e'/>
<id>urn:sha1:2b53e8b3ee7f143af785e2a39ce4e1614ff6c66e</id>
<content type='text'>
Leakfix.

* jk/remote-tracking-ref-leakfix:
  remote: always allocate branch.push_tracking_ref
  remote: fix leak in branch_get_push_1() with invalid "simple" config
  remote: drop const return of tracking_for_push_dest()
  remote: return non-const pointer from error_buf()
</content>
</entry>
<entry>
<title>Merge branch 'jk/remote-tracking-ref-leakfix' into hn/status-compare-with-push</title>
<updated>2026-01-20T21:35:47Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-01-20T21:35:47Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=2aa9b75b4319f94c3bf23c52ca704e010fc86e48'/>
<id>urn:sha1:2aa9b75b4319f94c3bf23c52ca704e010fc86e48</id>
<content type='text'>
* jk/remote-tracking-ref-leakfix:
  remote: always allocate branch.push_tracking_ref
  remote: fix leak in branch_get_push_1() with invalid "simple" config
  remote: drop const return of tracking_for_push_dest()
  remote: return non-const pointer from error_buf()
</content>
</entry>
<entry>
<title>remote: always allocate branch.push_tracking_ref</title>
<updated>2026-01-20T00:24:02Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2026-01-19T05:23:20Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=d79fff4a11a527f57516c62fe00777852bab719a'/>
<id>urn:sha1:d79fff4a11a527f57516c62fe00777852bab719a</id>
<content type='text'>
In branch_get_push(), we usually allocate a new string for the @{push}
ref, but will not do so in push.default=upstream mode, where we just
pass back the result of branch_get_upstream() directly.

This led to a hacky memory management scheme in e291c75a95 (remote.c:
add branch_get_push, 2015-05-21): we store the result in the
push_tracking_ref field of a "struct branch", under the assumption that
the branch struct will last until the end of the program. So even though
the struct doesn't know if it has an allocated string or not, it doesn't
matter because we hold on to it either way.

But that assumption was violated by f5ccb535cc (remote: fix leaking
config strings, 2024-08-22), which added a function to free branch
structs. Any struct which is fed to branch_release() is at risk of
leaking its push_tracking_ref member.

I don't think this can actually be triggered in practice. We rarely
actually free the branch structs, and we only fill in the
push_tracking_ref string lazily when it is needed. So triggering the
leak would require a code path that does both, and I couldn't find one.

Still, this is an ugly trap that may eventually spring on us. Since
there is only one code path in branch_get_push() that doesn't allocate,
let's just have it copy the string. And then we know that
push_tracking_ref is always allocated, and we can free it in
branch_release().

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>remote: fix leak in branch_get_push_1() with invalid "simple" config</title>
<updated>2026-01-20T00:24:02Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2026-01-19T05:22:08Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=9bf9eed093561f50091014faa7164c0325ea9ced'/>
<id>urn:sha1:9bf9eed093561f50091014faa7164c0325ea9ced</id>
<content type='text'>
Most of the code paths in branch_get_push_1() allocate a string for the
@{push} value. We then return the result, which is stored in a "struct
branch", so the value is not leaked.

But there's one path that does leak: when we are in the "simple" push
mode, we have to check that the @{push} value matches what we'd get for
@{upstream}. If it doesn't, we return an error, but forget to free the
@{push} value we computed.

Curiously, the existing tests don't trigger this with LSan, even though
they do exercise the code path. As far as I can tell, it should be
triggered via:

  git -c push.default=simple \
      -c branch.foo.remote=origin \
      -c branch.foo.merge=refs/heads/not-foo \
      rev-parse foo@{push}

which will complain that the upstream ("not-foo") does not match the
push destination ("foo"). We do die() shortly after this, but not until
after returning from branch_get_push_1(), which is where the leak
happens.

So it seems like a false negative in LSan. However, I can trigger it
reliably by printing the @{push} value using for-each-ref. This takes a
little more setup (because we need "foo" to actually exist to iterate
over it with for-each-ref), but we can piggy-back on the existing repo
config in t6300.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>remote: drop const return of tracking_for_push_dest()</title>
<updated>2026-01-20T00:24:02Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2026-01-19T05:20:26Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=782a719e99b8a66ef7e05481a481ddfc329985b5'/>
<id>urn:sha1:782a719e99b8a66ef7e05481a481ddfc329985b5</id>
<content type='text'>
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).

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).

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
