Welcome to the 59th edition of Git Rev News, a digest of all things Git. For our goals, the archives, the way we work, and how to contribute or to subscribe, see the Git Rev News page on git.github.io.
This edition covers what happened around the month of December 2019.
Push a ref to a remote with many refs
Patrick Marlier sent an email about performance issues when pushing from a local repository with a few refs to a remote repository with a lot more refs (1000+) and Git objects.
The local Git client receives the entire list of refs on the remote, and then checks in its repository if the objects exist for all the remote refs, but in Patrick’s case most of the objects are unknown.
As the local repository is using many alternates, Git will try to find each unknown object in all the alternates which amplifies the problem. To work around this Patrick showed a patch that skips the refs that are not part of the push when looking for objects.
Jeff King, alias Peff, replied to Patrick that the behavior is expected and that not looking at the refs which are not part of the push could miss objects that are already in the remote repo, and therefore result in pushing more objects than needed.
Peff proposed an alternative patch that uses an OBJECT_INFO_QUICK
flag when checking if objects exist. That flag makes the check
faster but less thorough, which is ok in this case.
Patrick then thanked Peff for the patch saying that he would try it, and later replied with some numbers showing a median time decreasing from 7 minutes and 38 seconds to 5 minutes and 40 seconds. Peff replied to those numbers suggesting applying the patch to Git 2.21 or higher, instead of Git 2.19, as a memory cache was introduced in 2.21 that would further speed up the checks.
In general it’s a good idea to always use the most recent Git version for maximum performance as improvements are regularly merged into each new version.
Meanwhile Junio Hamano, the Git maintainer wondered if improvements could be made regarding the different flags that can be used when checking objects. Peff replied that these flags have been coming up in discussions “about once a month lately” and pointed to a previous analysis made by Jonathan Tan. He also suggested some small changes in the flags according to the analysis.
Jonathan Tan then chimed in to give his opinion about the flag issue and mostly agreed with Peff’s suggestion. Junio then also agreed with Peff’s and Jonathan’s findings.
Jonathan Nieder reviewed Peff’s patch asking a few questions to make sure he understood it properly. Peff then answered those questions explaining a few more details.
Peff’s patch eventually got merged into the master branch and is included in the recent Git 2.25 release.
Various
Light reading
git switch <branch>
– Easily checkout git branches with this new command
by Irshad BluecastGit tools and sites
git-filter-repo v2.25.0 has been announced on the mailing list.
git-cinnabar 0.5.3 has also been announced on the mailing list.
GitVine by Insane Sharpness: A simpler visualisation of Git Commits, inspired by Clearcase Version Tree. Not open-source.
GitAhead is a graphical Git client for Windows, Linux and macOS designed to help you understand and manage your source code history, by SciTools™.
This edition of Git Rev News was curated by Christian Couder <christian.couder@gmail.com>, Jakub Narębski <jnareb@gmail.com>, Markus Jansen <mja@jansen-preisler.de> and Kaartic Sivaraam <kaartic.sivaraam@gmail.com>.