So this patch does not solve: - the memory leak mentioned by Jeff in https://public-inbox.org/git/20200328131553.GA643242@xxxxxxxxxxxxxxxxxxxxxxx/ - the non correct result in a triangular workflow mentioned in https://public-inbox.org/git/20200406175648.25737-1-damien.olivier.robert+git@xxxxxxxxx/ (aka v6, with an incomplete fix) - the code duplication between branch_get_push_remoteref and remote_get_1 (see my answer to Jeff's code mentioned above as to why his approach would give a micro regression). Luckily I have figured how to solve 2) and 3). Unfortunately I haven't have time to work on this since two weeks, so I have just sent the original bug fix first so at least this one gets fixed. This is exactly as v4, except I moved the tests around to make them easier to grok.