]> git.ipfire.org Git - thirdparty/git.git/commit
scalar: implement `scalar diagnose`
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Sat, 28 May 2022 23:11:15 +0000 (16:11 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 31 May 2022 06:07:31 +0000 (23:07 -0700)
commitaa5c79a33156c2f086ca3a149c11f1434d10f5ce
tree789179c1f40ecbe683f4cf075c134c709ebae0d1
parentb44855743b1674caf3bd4f42814473771b129c48
scalar: implement `scalar diagnose`

Over the course of Scalar's development, it became obvious that there is
a need for a command that can gather all kinds of useful information
that can help identify the most typical problems with large
worktrees/repositories.

The `diagnose` command is the culmination of this hard-won knowledge: it
gathers the installed hooks, the config, a couple statistics describing
the data shape, among other pieces of information, and then wraps
everything up in a tidy, neat `.zip` archive.

Note: originally, Scalar was implemented in C# using the .NET API, where
we had the luxury of a comprehensive standard library that includes
basic functionality such as writing a `.zip` file. In the C version, we
lack such a commodity. Rather than introducing a dependency on, say,
libzip, we slightly abuse Git's `archive` machinery: we write out a
`.zip` of the empty try, augmented by a couple files that are added via
the `--add-file*` options. We are careful trying not to modify the
current repository in any way lest the very circumstances that required
`scalar diagnose` to be run are changed by the `diagnose` run itself.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/scalar/scalar.c
contrib/scalar/scalar.txt
contrib/scalar/t/t9099-scalar.sh