Re: [PATCH v8 03/15] bugreport: add tool to generate debugging info
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Feb 26, 2020, 16:12 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2002261652400.46@tvgsbejvaqbjf.bet>
- In-Reply-To
- <20200220015858.181086-4-emilyshaffer@google.com>
Hi Emily,
On Wed, 19 Feb 2020, Emily Shaffer wrote:
Show 48 quoted lines
> diff --git a/bugreport.c b/bugreport.c
> new file mode 100644
> index 0000000000..8d4a76fdac
> --- /dev/null
> +++ b/bugreport.c
> @@ -0,0 +1,94 @@
> +#include "builtin.h"
> +#include "parse-options.h"
> +#include "stdio.h"
> +#include "strbuf.h"
> +#include "time.h"
> +
> +static const char * const bugreport_usage[] = {
> + N_("git bugreport [-o|--output-directory <file>] [-s|--suffix <format>]"),
> + NULL
> +};
> +
> +static int get_bug_template(struct strbuf *template)
> +{
> + const char template_text[] = N_(
> +"Thank you for filling out a Git bug report!\n"
> +"Please answer the following questions to help us understand your issue.\n"
> +"\n"
> +"What did you do before the bug happened? (Steps to reproduce your issue)\n"
> +"\n"
> +"What did you expect to happen? (Expected behavior)\n"
> +"\n"
> +"What happened instead? (Actual behavior)\n"
> +"\n"
> +"What's different between what you expected and what actually happened?\n"
> +"\n"
> +"Anything else you want to add:\n"
> +"\n"
> +"Please review the rest of the bug report below.\n"
> +"You can delete any lines you don't wish to share.\n");
> +
> + strbuf_addstr(template, template_text);
> + return 0;
> +}
> +
> +int cmd_main(int argc, const char **argv)
> +{
> + struct strbuf buffer = STRBUF_INIT;
> + struct strbuf report_path = STRBUF_INIT;
> + FILE *report;
> + time_t now = time(NULL);
> + char *option_output = NULL;
> + char *option_suffix = "%F-%H%M";This is not a portable `strftime()` format. Let's squash this in?
-- snipsnap -- Subject: [PATCH] fixup??? bugreport: add tool to generate debugging info
The `%F` format is an optional extension to the ISO C standard, see https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html
And sure enough, in Git for Windows, this leads to a test failure because that format is not supported in the version of the MSVC runtime that we're stuck with.
Let's just use the long-hand instead.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- bugreport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bugreport.c b/bugreport.c index a3528a2e2b8..3f78db182e6 100644 --- a/bugreport.c +++ b/bugreport.c @@ -338,7 +338,7 @@ int cmd_main(int argc, const char **argv) FILE *report; time_t now = time(NULL); char *option_output = NULL; - char *option_suffix = "%F-%H%M"; + char *option_suffix = "%Y-%m-%d-%H%M"; struct stat statbuf; int nongit_ok = 0; -- 2.25.1.windows.1