--- title: Git Rev News Edition 73 (March 27th, 2021) layout: default date: 2021-03-27 12:06:51 +0100 author: chriscool categories: [news] navbar: false --- ## Git Rev News: Edition 73 (March 27th, 2021) Welcome to the 73rd edition of [Git Rev News](https://git.github.io/rev_news/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](https://git.github.io/rev_news/rev_news/) on [git.github.io](http://git.github.io). This edition covers what happened during the month of February 2021. ## Discussions <!--- ### General --> <!--- ### Reviews --> ### Support * [[QUESTION] Tracking HEAD changes?](https://lore.kernel.org/git/CAGgn8PdU1GE_CZdGUpJWKzygd0O+Yn2BnAFGmPfKAxFpoVoqUA@mail.gmail.com/) Yaron Wittenstein asked on the mailing list if there is "any possible way to track changes to HEAD using hooks". He said he would like to listen to events such as "pre-head-checkout" and "post-head-checkout", but thought that it was only possible using a file watch over the `.git/refs` directory. Jeff King, alias Peff, first replied that he thought there was no better way, and that it was also required to watch `.git/HEAD`. He also showed some code for Linux/[inotify](https://en.wikipedia.org/wiki/Inotify) he uses to automatically run tests against the current commit: ```shell gitdir=$(git rev-parse --git-dir) # We need delete_self to pick up changes to HEAD (since it gets renamed # over), and "move" to pick up changes in the refs directories. inotifywait -qq -t 60 -e delete_self -e move -r "$gitdir/HEAD" "$gitdir/refs" ``` Peff also recommended using Michael Haggerty's [git-test tool](https://github.com/mhagger/git-test) for avoiding re-running tests against the same commits repeatedly. Then Peff replied to his previous email that Patrick Steinhardt also recently (since Git v2.28.0) implemented a new [ref-transaction hook](https://www.git-scm.com/docs/githooks#_reference_transaction) that can get triggered by updates to the ref that HEAD is pointing at. Yaron replied that this seems to do the trick, except the hook doesn't execute when switching branches. He found a work-around though by using the post-checkout hook in addition. Peff said that he thought the hook would be triggered when HEAD is updated by a branch switch, and wondered if that was a bug, a missing feature, or something intentional in the ref-transaction hook design. Patrick replied that the reason is that [symrefs](https://git-scm.com/docs/git-symbolic-ref) are not covered by the reference transaction mechanism itself, which existed before he implemented the new hook, and which the hook is using underneath. He also said that he should update the documentation to make it clearer what is covered by the hook and what's not. Yaron thanked Patrick for the clarification and asked if there were plans for the hook to be called when symrefs are updated. He also said it didn't seem intuitive to him that the index and working dirs are being updated, which calls the "post-index-change" hook, before the transaction is approved, which in turn calls the "ref-transaction" hook. Patrick replied that he didn't have plan for the hook to support symrefs, but wouldn't oppose such effort. About the order in which things were happening, he said that it is the way Git currently works and that the goal of the ref-transaction hook, which he worked on as part of his work for GitLab, was "to catch _all_ reference updates such that one can coordinate across multiple git nodes the same action to assert they're moving from the same state to the same state, regardless of whether they're doing a [git-push](https://git-scm.com/docs/git-push), [git-merge](https://git-scm.com/docs/git-merge) or [git-update-ref](https://git-scm.com/docs/git-update-ref)". Junio Hamano, the Git maintainer, further explained that "ref transaction is only about changes to the refs" and that "there is no such 'transaction' that treats a series of operations like object creation and index manipulation that may happen before a group of refs are updated as a single unit and make it atomic." Meanwhile Peff replied to Patrick's first explanation about why symrefs are not covered by the hook saying that it might be something that could be fixed. He also said that GitHub's custom repository replication mechanism does track symref updates, but uses a simple lock mechanism to get the state of the symrefs, while it uses a 3-phase commit based on custom code similar to the ref-transaction hook for normal refs. Yaron then [summarized his understanding](https://lore.kernel.org/git/CAGgn8PdYsfbSE2vRunOXO1JqXoM8LxoD+5Zn74jmb9vpqDXh+Q@mail.gmail.com/) of how things work and asked if he was right. Peff replied that it matched his understanding. <!--- ## Developer Spotlight: --> ## Releases + Git [2.31.0](https://public-inbox.org/git/xmqqwnu8z03c.fsf@gitster.g/), [2.31.0-rc2](https://public-inbox.org/git/xmqqblbs19uf.fsf@gitster.c.googlers.com/), [2.30.2 and below for CVE-2021-21300](https://public-inbox.org/git/xmqqim6019yd.fsf@gitster.c.googlers.com/), [2.31.0-rc1](https://public-inbox.org/git/xmqqr1kwk0h9.fsf@gitster.c.googlers.com/), [2.31.0-rc0](https://public-inbox.org/git/xmqqlfbbshza.fsf@gitster.g/) + Git for Windows [2.31.0(1)](https://github.com/git-for-windows/git/releases/tag/v2.31.0.windows.1), [2.31.0-rc2(1)](https://github.com/git-for-windows/git/releases/tag/v2.31.0-rc2.windows.1), [2.31.0-rc1(1)](https://github.com/git-for-windows/git/releases/tag/v2.31.0-rc1.windows.1), [2.31.0-rc0(1)](https://github.com/git-for-windows/git/releases/tag/v2.31.0-rc0.windows.1), [2.30.2(1)](https://github.com/git-for-windows/git/releases/tag/v2.30.2.windows.1) + Bitbucket Server [7.11](https://confluence.atlassian.com/bitbucketserver/bitbucket-server-release-notes-872139866.html) + GitHub Enterprise [3.0.2](https://help.github.com/enterprise-server@3.0/admin/release-notes#3.0.2), [2.22.8](https://help.github.com/enterprise-server@2.22/admin/release-notes#2.22.8), [2.21.16](https://help.github.com/enterprise-server@2.21/admin/release-notes#2.21.16), [3.0.1](https://help.github.com/enterprise-server@3.0/admin/release-notes#3.0.1), [2.22.7](https://help.github.com/enterprise-server@2.22/admin/release-notes#2.22.7), [2.21.15](https://help.github.com/enterprise-server@2.21/admin/release-notes#2.21.15), [2.20.24](https://help.github.com/enterprise-server@2.20/admin/release-notes#2.20.24) + GitLab [13.10](https://about.gitlab.com/releases/2021/03/22/gitlab-13-10-released/), [13.9.4, 13.8.6, and 13.7.9](https://about.gitlab.com/releases/2021/03/17/security-release-gitlab-13-9-4-released/), [13.9.3](https://about.gitlab.com/releases/2021/03/08/gitlab-13-9-3-released/), [13.9.2, 13.8.5 and 13.7.8](https://about.gitlab.com/releases/2021/03/04/security-release-gitlab-13-9-2-released/), [13.9.1](https://about.gitlab.com/releases/2021/02/23/gitlab-13-9-1-released/) + GitKraken [7.5.2](https://support.gitkraken.com/release-notes/current) + GitHub Desktop [2.6.6](https://desktop.github.com/release-notes/), [2.6.5](https://desktop.github.com/release-notes/), [2.6.4](https://desktop.github.com/release-notes/) ## Other News __Various__ * [Git clone vulnerability announced](https://github.blog/2021-03-09-git-clone-vulnerability-announced/) by Taylor Blau on GitHub Blog, and [A vulnerability in Git](https://lwn.net/Articles/848935/) by Jake Edge on LWN.net. * [Highlights from Git 2.31](https://github.blog/2021-03-15-highlights-from-git-2-31/) by Taylor Blau on GitHub Blog. * Congratulations to [Joey Salazar](https://jsal.home.blog/) and [Charvi Mendiratta](https://charvi-077.github.io/) who successfully completed their [Outreachy internship](https://www.outreachy.org/alums/) working on Git! __Light reading__ * [Optimizing git’s merge machinery, #1](https://blog.palantir.com/optimizing-gits-merge-machinery-1-127ceb0ef2a1) and [#2](https://blog.palantir.com/optimizing-gits-merge-machinery-2-d81391b97878) by Elijah Newren on Palantir Blog. * [How Does Git Work?](https://www.honeybadger.io/blog/how-does-git-work/) by Julie Kent. * [Git is my buddy: Effective Git as a solo developer](https://mikkel.ca/blog/git-is-my-buddy-effective-solo-developer/) by Mikkel Paulson. * [How to Utilize Submodules within Git Repos](https://blog.bitsrc.io/how-to-utilize-submodules-within-git-repos-5dfdd1c62d09): One Solution When the Primary Code Can be Open Source, but Specific Content Needs to be Private, by Paige Niedringhaus on Bits and Pieces blog (a Medium site). * [How to use .mailmap file in git repository](https://lukasmestan.com/using-mailmap-in-git-repository/) by Lukáš Mešťan (2020). * [What is Trunk Based Development? A Different Approach to the Software Development Lifecycle](https://www.freecodecamp.org/news/what-is-trunk-based-development/) by Kealan Parr on freeCodeCamp. This approach was also one of those described in [Patterns for Managing Source Code Branches](https://martinfowler.com/articles/branching-patterns.html) by Martin Fowler, which was mentioned in [Git Rev News Edition #63](https://git.github.io/rev_news/2020/05/28/edition-63/). * [Improving large monorepo performance on GitHub](https://github.blog/2021-03-16-improving-large-monorepo-performance-on-github/) by Scott Arbeit on GitHub Blog, in the Engineering section. * [Hacking the git shell prompt](https://blog.plover.com/prog/git-prompt-hook-hack.html) by Mark Dominus describes a hack creating a generic mechanism for abbreviating or transforming the branch name in the prompt. * [Boost Your Programming Skills by Reading Git's Code](https://www.freecodecamp.org/news/boost-programming-skills-read-git-code/) by Jacob Stopak on freeCodeCamp. * [How To Set Up Continuous Integration With Git and Jenkins](https://www.lambdatest.com/blog/how-to-setup-continuous-integration-with-git-jenkins/) by Suparna Khamaru on LambdaTest Blog. * [Store your Kubernetes Secrets in Git thanks to Kubeseal. Hello SealedSecret!](https://dev.to/stack-labs/store-your-kubernetes-secrets-in-git-thanks-to-kubeseal-hello-sealedsecret-2i6h) by Aurélie Vache on Dev.to. More generic solutions for storing secrets in Git repository were described in Git Rev News editions [#39](https://git.github.io/rev_news/2018/05/16/edition-39/) and [#57](https://git.github.io/rev_news/2019/11/20/edition-57/), among others. __Git tools and sites__ * [Project GITenberg](http://gitenberg.github.io/) is a Free and Open, Collaborative, Trackable and Scriptable digital library. It leverages the power of the Git version control system and the collaborative potential of GitHub to make books more open. The books in this project originate from the work of [Project Gutenberg](http://www.gutenberg.org/), a volunteer effort to digitize and archive cultural works, mostly the full texts of public domain books. * [ungit](https://github.com/FredrikNoren/ungit) is a Git command-line UI with text editor integrations, that utilizes your web browser as graphical interface. It is intended to make Git easier to use. In this it is somewhat similar to no longer actively developed [Easy Git](https://people.gnome.org/~newren/eg/). ## Credits 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>> with help from Ævar Arnfjörð Bjarmason and Matheus Tavares Bernardino.