git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacob Stopak <jacob@initialcommit.io>
To: git@vger.kernel.org
Cc: Jacob Stopak <jacob@initialcommit.io>
Subject: [PATCH v2 2/3] bugreport: match diagnostics filename with report
Date: Sat, 14 Oct 2023 20:42:36 -0700	[thread overview]
Message-ID: <20231015034238.100675-3-jacob@initialcommit.io> (raw)
In-Reply-To: <20231015034238.100675-1-jacob@initialcommit.io>

When using the --diagnose flag, match the diagnostics zip filename with
the bugreport filename in the scenario where '+i' syntax is used.

Signed-off-by: Jacob Stopak <jacob@initialcommit.io>
---
 builtin/bugreport.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/builtin/bugreport.c b/builtin/bugreport.c
index 71ee7d7f4b..573d270677 100644
--- a/builtin/bugreport.c
+++ b/builtin/bugreport.c
@@ -112,6 +112,7 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix)
 	char *prefixed_filename;
 	size_t output_path_len;
 	int ret;
+	int i = 1;
 
 	const struct option bugreport_options[] = {
 		OPT_CALLBACK_F(0, "diagnose", &diagnose, N_("mode"),
@@ -142,7 +143,6 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix)
 	strbuf_addstr(&report_path, ".txt");
 
 	if (strbuf_cmp(&option_suffix, &default_option_suffix) == 0) {
-		int i = 1;
 		int pos = report_path.len - 4;
 		while (file_exists(report_path.buf) && i < 10) {
 			if (i > 1)
@@ -167,6 +167,7 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix)
 		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))
-- 
2.42.0.298.gd89efca819.dirty


  parent reply	other threads:[~2023-10-15  3:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-14  4:01 [PATCH] bugreport: add 'seconds' to default outfile name Jacob Stopak
2023-10-14 10:35 ` Kristoffer Haugsbakk
2023-10-14 16:27 ` Junio C Hamano
2023-10-14 16:33   ` Dragan Simic
2023-10-14 17:45     ` Junio C Hamano
2023-10-14 17:52       ` Dragan Simic
2023-10-15  3:07         ` Jacob Stopak
2023-10-15  3:13           ` Dragan Simic
2023-10-15  3:01   ` Jacob Stopak
2023-10-15 17:06     ` Junio C Hamano
2023-10-15  3:42 ` [PATCH v2 0/3] bugreport: include +i in outfile suffix as needed Jacob Stopak
2023-10-15  3:42   ` [PATCH v2 1/3] " Jacob Stopak
2023-10-15 17:36     ` Junio C Hamano
2023-10-16 21:40     ` [PATCH v3 0/1] " Jacob Stopak
2023-10-16 21:40       ` [PATCH v3 1/1] " Jacob Stopak
2023-10-16 22:55         ` Junio C Hamano
2023-10-17  3:17           ` Jacob Stopak
2023-10-21  0:39         ` Junio C Hamano
2023-10-26 21:19         ` Emily Shaffer
2023-10-27  6:34           ` Jacob Stopak
2024-01-06  4:54             ` Jacob Stopak
2023-10-15  3:42   ` Jacob Stopak [this message]
2023-10-15  3:42   ` [PATCH v2 3/3] bugreport: don't create --diagnose zip w/o report Jacob Stopak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231015034238.100675-3-jacob@initialcommit.io \
    --to=jacob@initialcommit.io \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).