summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-03-25 23:16:34 (GMT)
committerJunio C Hamano <gitster@pobox.com>2024-03-25 23:16:34 (GMT)
commitd921c365ee7b2c74b605cd6a8668c9b2e699992b (patch)
tree74bca45ca838ac8d0e6105a2a33e984c96efedb6 /builtin
parent199074f8932f85abac3b40d8e79c63d9e8f94ca0 (diff)
parentb3b57c69dad91382ccc36ebf5d668454607dd568 (diff)
downloadgit-d921c365ee7b2c74b605cd6a8668c9b2e699992b.zip
git-d921c365ee7b2c74b605cd6a8668c9b2e699992b.tar.gz
git-d921c365ee7b2c74b605cd6a8668c9b2e699992b.tar.bz2
Merge branch 'js/bugreport-no-suffix-fix'
"git bugreport --no-suffix" was not supported and instead segfaulted, which has been corrected. * js/bugreport-no-suffix-fix: bugreport.c: fix a crash in `git bugreport` with `--no-suffix` option
Diffstat (limited to 'builtin')
-rw-r--r--builtin/bugreport.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/builtin/bugreport.c b/builtin/bugreport.c
index 3106e56..25f860a 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) <path>] [(-s | --suffix) <format>]\n"
+ N_("git bugreport [(-o | --output-directory) <path>]\n"
+ " [(-s | --suffix) <format> | --no-suffix]\n"
" [--diagnose[=<mode>]]"),
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)) {