[フレーム]
BT

InfoQ Software Architects' Newsletter

A monthly overview of things you need to know as an architect or aspiring architect.

View an example

We protect your privacy.

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Unlock the full InfoQ experience

Unlock the full InfoQ experience by logging in! Stay updated with your favorite authors and topics, engage with content, and download exclusive resources.

Log In
or

Don't have an InfoQ account?

Register
  • Stay updated on topics and peers that matter to youReceive instant alerts on the latest insights and trends.
  • Quickly access free resources for continuous learningMinibooks, videos with transcripts, and training materials.
  • Save articles and read at anytimeBookmark articles to read whenever youre ready.

Topics

Choose your language

InfoQ Homepage News Git 2.37 Brings Built-in File Monitor, Improved Pruning, and More

Git 2.37 Brings Built-in File Monitor, Improved Pruning, and More

Jun 30, 2022 2 min read

Write for InfoQ

Feed your curiosity. Help 550k+ global
senior developers
each month stay ahead.
Get in touch

Git 2.37 brings many new and improved features, including a built-in file system monitor on Windows and macOS, better unreachable objects management, improved external diff, faster git add, and more.

Git's new built-in file monitor aims to improve performance when accessing the file system to detect file changes. This may reduce the time required to execute git status and other commands. Git has supported the possibility of hooking tools like Watchman since version 2.16. This option was not easy to configure, though, and not frequently used. Instead, you can now enable the built-in file monitor by using the following configuration option:

git config core.fsmonitor true

According to Jeff Hostetler, the author of the patches for git's new file monitor, the implementation relies mostly on cross-platform code with custom backends leveraging OS-native features, i.e. FSEvents on macOS and ReadDirectoryChangesW on Windows. A Linux backend would probably use either inotify or fanotify, Hostetler says, but that work has not started yet.

To improve pruning performance, git 2.37 introduces cruft packs, aimed at reducing the chance of data races when removing unreachable objects.

Unreachable objects aren’t removed immediately, since doing so could race with an incoming push which may reference an object which is about to be deleted. Instead, those unreachable objects are stored as loose objects and stay that way until they are older than the expiration window, at which point they are removed by git-prune.

Unreachable objects that have not left their grace period tend to accumulate and enlarge .git/objects. This can lead to decreased performance and in extreme cases to inode starvation and performance degradation of the whole system.

Cruft packs eliminate the need to store unreachable objects in loose files and instead consolidate them in a single packfile between successive prune operations along with a timestamp file to track grace periods.

Another improvement in git 2.37 deals with diff temp files. Instead of using loose files, diffs are now generated inside a temporary directory under the same basename, using mks_tempfile_ts. This allows the files to have arbitrary names, each in their own separate directory. The main benefit this brings in is with graphical diff programs, that may display a nicer output.

As mentioned, git 2.37 also includes improved performance for select commands, such as git add -i, which was rewritten in C from Perl and been under testing for a while. The latest git version adopts the new C implementation as a default.

As a final note, many developers will welcome the new git -v and git -h options, which will be interpreted as git --version and git --help respectively. Interestingly, while apparently a no-brainer, this patch still required some discussion.

Git 2.37 includes many more changes than can be covered here, so do not miss the official release note for the full details. Additionally, you can also check out GitHub's and GitKraken's takes on what is most relevant in the new release.

About the Author

Sergio De Simone

Show moreShow less

Rate this Article

Adoption
Style

This content is in the git topic

Related Topics:

Related Content

The InfoQ Newsletter

A round-up of last week’s content on InfoQ sent out every Tuesday. Join a community of over 250,000 senior developers. View an example

We protect your privacy.

BT

AltStyle によって変換されたページ (->オリジナル) /