diff options
author | Victoria Dye <vdye@github.com> | 2022-08-12 22:10:14 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-08-12 22:20:02 +0200 |
commit | 33cba726f03e1e06b10b85cf4a1cbd1017810486 (patch) | |
tree | cd8c7fdd2b4655f4226aede0429a715e630fc67c /diagnose.h | |
parent | scalar-diagnose: move functionality to common location (diff) | |
download | git-33cba726f03e1e06b10b85cf4a1cbd1017810486.tar.xz git-33cba726f03e1e06b10b85cf4a1cbd1017810486.zip |
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>
Diffstat (limited to '')
-rw-r--r-- | diagnose.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/diagnose.h b/diagnose.h index 06dca69bda..998775857a 100644 --- a/diagnose.h +++ b/diagnose.h @@ -3,6 +3,12 @@ #include "strbuf.h" -int create_diagnostics_archive(struct strbuf *zip_path); +enum diagnose_mode { + DIAGNOSE_NONE, + DIAGNOSE_STATS, + DIAGNOSE_ALL +}; + +int create_diagnostics_archive(struct strbuf *zip_path, enum diagnose_mode mode); #endif /* DIAGNOSE_H */ |