diff --git a/Documentation/git-bugreport.txt b/Documentation/git-bugreport.txt index ca626f7fc6..112658b3c3 100644 --- a/Documentation/git-bugreport.txt +++ b/Documentation/git-bugreport.txt @@ -8,7 +8,8 @@ git-bugreport - Collect information for user to file a bug report SYNOPSIS -------- [verse] -'git bugreport' [(-o | --output-directory) ] [(-s | --suffix) ] +'git bugreport' [(-o | --output-directory) ] + [(-s | --suffix) | --no-suffix] [--diagnose[=]] DESCRIPTION @@ -51,9 +52,12 @@ OPTIONS -s :: --suffix :: +--no-suffix:: Specify an alternate suffix for the bugreport name, to create a file named 'git-bugreport-'. This should take the form of a strftime(3) format string; the current local time will be used. + `--no-suffix` disables the suffix and the file is just named + `git-bugreport` without any disambiguation measure. --no-diagnose:: --diagnose[=]:: diff --git a/builtin/bugreport.c b/builtin/bugreport.c index 3106e56a13..25f860a0d9 100644 --- a/builtin/bugreport.c +++ b/builtin/bugreport.c @@ -64,7 +64,8 @@ static void get_populated_hooks(struct strbuf *hook_info, int nongit) } static const char * const bugreport_usage[] = { - N_("git bugreport [(-o | --output-directory) ] [(-s | --suffix) ]\n" + N_("git bugreport [(-o | --output-directory) ]\n" + " [(-s | --suffix) | --no-suffix]\n" " [--diagnose[=]]"), NULL }; @@ -138,8 +139,11 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix) strbuf_complete(&report_path, '/'); output_path_len = report_path.len; - strbuf_addstr(&report_path, "git-bugreport-"); - strbuf_addftime(&report_path, option_suffix, localtime_r(&now, &tm), 0, 0); + strbuf_addstr(&report_path, "git-bugreport"); + if (option_suffix) { + strbuf_addch(&report_path, '-'); + strbuf_addftime(&report_path, option_suffix, localtime_r(&now, &tm), 0, 0); + } strbuf_addstr(&report_path, ".txt"); switch (safe_create_leading_directories(report_path.buf)) {