]> git.ipfire.org Git - thirdparty/git.git/commit
diagnose.c: add option to configure archive contents
authorVictoria Dye <vdye@github.com>
Fri, 12 Aug 2022 20:10:14 +0000 (20:10 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 12 Aug 2022 20:20:02 +0000 (13:20 -0700)
commit33cba726f03e1e06b10b85cf4a1cbd1017810486
treecd8c7fdd2b4655f4226aede0429a715e630fc67c
parentbb2c34956ad4fab1e7619327219fb5a5a49f571b
diagnose.c: add option to configure archive contents

Update 'create_diagnostics_archive()' to take an argument 'mode'. When
archiving diagnostics for a repository, 'mode' is used to selectively
include/exclude information based on its value. The initial options for
'mode' are:

* DIAGNOSE_NONE: do not collect any diagnostics or create an archive
  (no-op).
* DIAGNOSE_STATS: collect basic repository metadata (Git version, repo path,
  filesystem available space) as well as sizing and count statistics for the
  repository's objects and packfiles.
* DIAGNOSE_ALL: collect basic repository metadata, sizing/count statistics,
  and copies of the '.git', '.git/hooks', '.git/info', '.git/logs', and
  '.git/objects/info' directories.

These modes are introduced to provide users the option to collect
diagnostics without the sensitive information included in copies of '.git'
dir contents. At the moment, only 'scalar diagnose' uses
'create_diagnostics_archive()' (with a hardcoded 'DIAGNOSE_ALL' mode to
match existing functionality), but more callers will be introduced in
subsequent patches.

Finally, refactor from a hardcoded set of 'add_directory_to_archiver()'
calls to iterative invocations gated by 'DIAGNOSE_ALL'. This allows for
easier future modification of the set of directories to archive and improves
error reporting when 'add_directory_to_archiver()' fails.

Helped-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/scalar/scalar.c
diagnose.c
diagnose.h