@@ -161,21 +161,6 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix)
report_path.buf);
}
- /* Prepare diagnostics, if requested */
- if (diagnose != DIAGNOSE_NONE) {
- struct strbuf zip_path = STRBUF_INIT;
- strbuf_add(&zip_path, report_path.buf, output_path_len);
- strbuf_addstr(&zip_path, "git-diagnostics-");
- strbuf_addftime(&zip_path, option_suffix.buf, localtime_r(&now, &tm), 0, 0);
- if (i > 1) strbuf_addf(&zip_path, "+%d", i-1);
- strbuf_addstr(&zip_path, ".zip");
-
- if (create_diagnostics_archive(&zip_path, diagnose))
- die_errno(_("unable to create diagnostics archive %s"), zip_path.buf);
-
- strbuf_release(&zip_path);
- }
-
/* Prepare the report contents */
get_bug_template(&buffer);
@@ -202,6 +187,22 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix)
fprintf(stderr, _("Created new report at '%s'.\n"),
user_relative_path);
+ /* Prepare diagnostics, if requested */
+ if (diagnose != DIAGNOSE_NONE) {
+ struct strbuf zip_path = STRBUF_INIT;
+ strbuf_add(&zip_path, report_path.buf, output_path_len);
+ strbuf_addstr(&zip_path, "git-diagnostics-");
+ strbuf_addftime(&zip_path, option_suffix.buf, localtime_r(&now, &tm), 0, 0);
+ if (i > 1) strbuf_addf(&zip_path, "+%d", i-1);
+ strbuf_addstr(&zip_path, ".zip");
+
+ if (create_diagnostics_archive(&zip_path, diagnose))
+ die_errno(_("unable to create diagnostics archive %s"), zip_path.buf);
+
+ strbuf_release(&zip_path);
+ }
+
+
free(prefixed_filename);
strbuf_release(&buffer);
strbuf_release(&default_option_suffix);
Prevent the diagnostics zip file from being created when the bugreport itself is not created due to an error. Signed-off-by: Jacob Stopak <jacob@initialcommit.io> --- builtin/bugreport.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)