mirror of
https://github.com/git/git.git
synced 2024-05-13 12:16:10 +02:00
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
This commit is contained in:
commit
d921c365ee
|
@ -8,7 +8,8 @@ git-bugreport - Collect information for user to file a bug report
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
[verse]
|
[verse]
|
||||||
'git bugreport' [(-o | --output-directory) <path>] [(-s | --suffix) <format>]
|
'git bugreport' [(-o | --output-directory) <path>]
|
||||||
|
[(-s | --suffix) <format> | --no-suffix]
|
||||||
[--diagnose[=<mode>]]
|
[--diagnose[=<mode>]]
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
|
@ -51,9 +52,12 @@ OPTIONS
|
||||||
|
|
||||||
-s <format>::
|
-s <format>::
|
||||||
--suffix <format>::
|
--suffix <format>::
|
||||||
|
--no-suffix::
|
||||||
Specify an alternate suffix for the bugreport name, to create a file
|
Specify an alternate suffix for the bugreport name, to create a file
|
||||||
named 'git-bugreport-<formatted-suffix>'. This should take the form of a
|
named 'git-bugreport-<formatted-suffix>'. This should take the form of a
|
||||||
strftime(3) format string; the current local time will be used.
|
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::
|
--no-diagnose::
|
||||||
--diagnose[=<mode>]::
|
--diagnose[=<mode>]::
|
||||||
|
|
|
@ -64,7 +64,8 @@ static void get_populated_hooks(struct strbuf *hook_info, int nongit)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char * const bugreport_usage[] = {
|
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>]]"),
|
" [--diagnose[=<mode>]]"),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
@ -138,8 +139,11 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix)
|
||||||
strbuf_complete(&report_path, '/');
|
strbuf_complete(&report_path, '/');
|
||||||
output_path_len = report_path.len;
|
output_path_len = report_path.len;
|
||||||
|
|
||||||
strbuf_addstr(&report_path, "git-bugreport-");
|
strbuf_addstr(&report_path, "git-bugreport");
|
||||||
strbuf_addftime(&report_path, option_suffix, localtime_r(&now, &tm), 0, 0);
|
if (option_suffix) {
|
||||||
|
strbuf_addch(&report_path, '-');
|
||||||
|
strbuf_addftime(&report_path, option_suffix, localtime_r(&now, &tm), 0, 0);
|
||||||
|
}
|
||||||
strbuf_addstr(&report_path, ".txt");
|
strbuf_addstr(&report_path, ".txt");
|
||||||
|
|
||||||
switch (safe_create_leading_directories(report_path.buf)) {
|
switch (safe_create_leading_directories(report_path.buf)) {
|
||||||
|
|
Loading…
Reference in New Issue