Git Rev News: Edition 75 (May 27th, 2021)
Welcome to the 75th 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 during the month of April 2021.
The following two students have been officially accepted to work on Git as part of the GSoC 2021:
Thanks to the students who applied and worked on micro-projects, but couldn’t be selected! We hope to continue to see you in the community!
Felipe Contreras posted a fun analysis of how often various commit trailers (
tested-by, etc) appear in the git.git project.
signed-off-by(which all contributions must include), the most common trailers are
acked-by(1945 occurences) and
reviewed-by(1729 occurences), together accounting for almost half of all trailers.
The next 4 most common trailers give a great insight into just how much collaboration goes on in the git.git project:
Perhaps most interesting is the long list of trailers that have only been seen once, though now that this list is out there we may see more of
cheered-on-byin the future.
One can also note that this distribution roughly follows Zip’s law; the 10th most popular line (“improved-by”) is about 1/10 as popular as the 1st.
This script can be used to replicate the analysis.
ZheNing Hu sent a patch to the mailing list to add the new
%chformatting options to the “pretty formats”. The “pretty formats” are the main way for users to customize the output of the
git rev-list, and
These formats are specified by the
--format=<format>command line flags, where
<format>is the actual “pretty format”, and can be either a “built-in format”, like
medium, etc, or
format:<string>, which is called a “format string”.
These format strings work in a similar way to
printf()formats, as they can contain placeholders starting with a
%character, that will be expanded by the command. For example
%Hwill be expanded to print the commit hash,
%anthe author name, etc.
A lot of placeholders already exist. For the author date, there are:
%as. For the committer date, there are the corresponding
%csones. Each pair of these placeholders uses a different date format. For example,
%cIuse the “strict ISO 8601 format”.
%cd, though, are special as they use the format specified by the
--date=<format>command line flag, so for example with
%cdwill behave in the same way as
ZheNing’s patch added the new
%chplaceholders that would behave in the same way as
--date=human. The rationale for the patch being that there are placeholders corresponding to most of the
Taylor Blau was the first to review ZheNing’s patch and found it “pretty good”, as it was similar to a previous patch by René Scharfe that added the
%csplaceholders for dates in the “short date format”. ZheNing acknowledged that he indeed learned from René’s patch.
Philip Oakley, though, commented on the documentation part of the patch suggesting to add an example similar to
YYYY-MM-DDfor the short format. ZheNing replied that in the “human format” a date could take many forms, so he said he would rather add links to the documentation of the “human format”.
ZheNing then sent a version 2 of his patch where he had added the links. Philip suggested further small superficial changes to the link and the related text added in this version though.
Meanwhile Ævar Arnfjörð Bjarmason sent a small patch series that made a “couple of trivial changes” to the tests related to
%cI, and at the same time suggested ZheNing to make similar changes to the tests in his patch.
As the version 3 of the patch had already been merged to the “next” branch before ZheNing sent the version 4, the typo got noticed by Martin Ågren who sent a small patch series fixing this typo as well as another unrelated one.
Eventually both ZheNing’s patch and Martin’s patches were merged into the “master” branch, so that their improvements will appear in the soon upcoming Git version v2.32.0.
Developer Spotlight: Patrick Steinhardt
Who are you and what do you do?
I’m a software developer working at GitLab, more specifically in the team working on Gitaly. Gitaly is our RPC interface to all Git repositories, so it is the backbone to all things Git at GitLab.
In my own free time, I love to tinker with my Gentoo-based systems and tailor them to my own needs, which results in occasional drive-by patches to all kinds of open source projects to scratch my own itches.
What would you name your most important contribution to Git?
To me, this is the introduction of the reference-transaction hook, which gets executed whenever a reference is about to be updated. This allows tight control over all reference updates happening in a given repository in a command-agnostic way. At GitLab, we use this hook to coordinate reference updates across multiple replicas of the same repository such that we can be sure that all nodes have the same state and move to the same state.
My most important contributions I’d not locate in the Git project itself though, but instead in libgit2. While I unfortunately haven’t found the time to contribute to it lately, I’ve done a lot more work on libgit2 than I did on Git. And there it’s probably the initial introduction of support for worktrees, maintenance of the CMake build system and work on the gitconfig subsystem.
What are you doing on the Git project these days, and why?
My current work is mostly focussed on tuning performance of some areas we have found to be slow for gitlab.com. This has motivated the recent introduction of a new
git-rev-list(1)filter which allows to filter by object type via
--filter=object:type=<type>. This makes it easy to find for example all blobs introduced between two revisions.
And right now I’m trying to devise a new implementation of the object connectivity check performed by
git-receive-pack(1)whenever a push gets accepted on the server side. Depending on the repository’s shape, the current implementation can be a major bottleneck and take dozens of seconds to compute even for small pushes. You may have noticed this check when it says “Checking connectivity” on a push.
If you could get a team of expert developers to work full time on something in Git for a full year, what would it be?
I’m obviously biased coming from the libgit2 project, but I’d really love to further push the libification of Git. There has been great progress on this front already to make internal C interfaces look more like the typical interfaces you’d see from a linkable library. But my dream would be to merge the efforts of Git and libgit2 such that Git also provides an official library which can be linked against in your own program.
If you could remove something from Git without worrying about backwards compatibility, what would it be?
Tough question. There’s many user-facing commands which could benefit from a more consistent design, but my take is that these probably could provide an improved user interface while still retaining backwards compatibility.
But what I’d really love to get rid of is the file-based reference backend. It works reasonably well to represent references as file paths in smallish repositories, but even there it imposes limitations which are only a result of its implementation. It’s also inefficient for bigger repositories and does not really allow for atomic modification of multiple references at once. There luckily is ongoing work on the reftable backend, which fixes many of the shortcomings, but it will likely still take some time to land.
What is your favorite Git-related tool/library, outside of Git itself?
I guess the answer to that question is going to be obvious by now: libgit2.
- Git 2.32.0-rc1, 2.32.0-rc0
- Git for Windows 2.32.0-rc1(1), 2.32.0-rc0(1)
- GitLab 13.12, 13.11.4, 13.11.3, 13.11.2, 13.10.4, and 13.9.7
- Bitbucket Server 7.13
- Gerrit Code Review 3.4.0, 3.3.4, 3.2.10, 3.1.15, 3.2.9, 3.1.14
- GitHub Enterprise 3.0.7, 2.22.13, 2.21.21, 3.1.0, 3.0.6, 2.22.12, 2.21.20
- Magit 3.0.0
- Forge 0.2.0
- GitKraken 7.6.1, 7.6.0
- GitHub Desktop 2.8.1, 2.8.0
- Linus Torvalds was interviewed on the Tag1 Consulting site about 30 Years Of Linux and about Git. A part 2 of the interview not related to Git has also been published.
- GitHub announced that security keys are now supported for SSH Git operations via
- Scaling monorepo maintenance by Taylor Blau on GitHub Blog, with reverse indexes, multi-pack bitmaps, and geometric repacking.
- Developing a script in small steps by Volker Kroll on Dev.to.
- Plotting the source code “TODO” history of the most popular open source projects by Martin Schleiss.
- Git Push to Remote Branch - How to Push a Local Branch to Origin by John Mosesman on freeCodeCamp.org.
- Heroku-style deployments with Docker and Git tags
post-receivehook) by Ricardo Ander-Egg Aguilar.
- YubiKey for SSH, Login, 2FA, GPG and Git Signing by Marco Pivetta (Ocramius).
- Diff and merge CSV files in your Git client using daff by Paul Fitz (2014).
- Visual Studio code editor: Eight tips for using GitLab VS Code extension by Tomas Vik on GitLab Blog.
- Top Ten Git Tips & Tricks by Julie Kent on Honeybadger blog.
Git tools and sites
- Komit is a Node.js based small command line application providing interactive prompt, designed to be run as a Git hook to help follow the Conventional Commit message standard. This standard was mentioned in Git Rev News Edition #52 and #54; another tool that helps follow this standard is Sailr (also mentioned in edition #52).
- Flat Data explores how to make it easy to work with data in Git and GitHub. The Flat Data project incorporates three different pieces: the Flat Action (GitHub Action), the Flat Editor VS Code extension, and the Flat Viewer website.
- git-split-diffs, a Node.js
command-line application, provides side-by-side split diffs with syntax
highlighting in your terminal, and can be used via
- daff: data diff is a library and a tool for comparing tables, producing a summary of their differences, and using such a summary as a patch file. It is optimized for comparing tables that share a common origin, in other words multiple versions of the “same” table. With daff, you can also make Git diffs and merges table-aware.
- github-csv-diff and CSVHub are both Chrome extensions to show CSV diffs on GitHub.
- Semgrep is a fast, Open Source, static analysis tool for finding bugs and enforcing code standards at editor, commit, or CI time; rules look like the code you’re searching.
This edition of Git Rev News was curated by Christian Couder <email@example.com>, Jakub Narębski <firstname.lastname@example.org>, Markus Jansen <email@example.com> and Kaartic Sivaraam <firstname.lastname@example.org> with help from Patrick Steinhardt, Andrew Ardill, Felipe Contreras and Jonas Bernoulli.