Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictoria Dye <vdye@github.com>2022-08-12 23:10:16 +0300
committerJunio C Hamano <gitster@pobox.com>2022-08-12 23:20:02 +0300
commit7ecf193f7d621f618b322498d884ee103a44522f (patch)
tree0f32a7af200f886cadbceab0fc86be37f2789f70 /builtin/diagnose.c
parent6783fd3cef0d6625e8a6d9d42d76042447078401 (diff)
builtin/diagnose.c: add '--mode' option
Create '--mode=<mode>' option in 'git diagnose' to allow users to optionally select non-default diagnostic information to include in the output archive. Additionally, document the currently-available modes, emphasizing the importance of not sharing a '--mode=all' archive publicly due to the presence of sensitive information. Note that the option parsing callback - 'option_parse_diagnose()' - is added to 'diagnose.c' rather than 'builtin/diagnose.c' so that it may be reused in future callers configuring a diagnostics archive. 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 'builtin/diagnose.c')
-rw-r--r--builtin/diagnose.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin/diagnose.c b/builtin/diagnose.c
index 832493bba6..cd260c2015 100644
--- a/builtin/diagnose.c
+++ b/builtin/diagnose.c
@@ -3,7 +3,7 @@
#include "diagnose.h"
static const char * const diagnose_usage[] = {
- N_("git diagnose [-o|--output-directory <path>] [-s|--suffix <format>]"),
+ N_("git diagnose [-o|--output-directory <path>] [-s|--suffix <format>] [--mode=<mode>]"),
NULL
};
@@ -12,6 +12,7 @@ int cmd_diagnose(int argc, const char **argv, const char *prefix)
struct strbuf zip_path = STRBUF_INIT;
time_t now = time(NULL);
struct tm tm;
+ enum diagnose_mode mode = DIAGNOSE_STATS;
char *option_output = NULL;
char *option_suffix = "%Y-%m-%d-%H%M";
char *prefixed_filename;
@@ -21,6 +22,9 @@ int cmd_diagnose(int argc, const char **argv, const char *prefix)
N_("specify a destination for the diagnostics archive")),
OPT_STRING('s', "suffix", &option_suffix, N_("format"),
N_("specify a strftime format suffix for the filename")),
+ OPT_CALLBACK_F(0, "mode", &mode, N_("(stats|all)"),
+ N_("specify the content of the diagnostic archive"),
+ PARSE_OPT_NONEG, option_parse_diagnose),
OPT_END()
};
@@ -47,7 +51,7 @@ int cmd_diagnose(int argc, const char **argv, const char *prefix)
}
/* Prepare diagnostics */
- if (create_diagnostics_archive(&zip_path, DIAGNOSE_STATS))
+ if (create_diagnostics_archive(&zip_path, mode))
die_errno(_("unable to create diagnostics archive %s"),
zip_path.buf);