Re: [PATCH v3 1/1] bugreport: include +i in outfile suffix as needed
- From
Jacob Stopak <jacob@initialcommit.io>
- Date
- Oct 17, 2023, 03:17 UTC
- Message-ID
- <ZS38ykTuqHXYnU57.jacob@initialcommit.io>
- In-Reply-To
- <xmqq4jiqkwi1.fsf@gitster.g>
On Mon, Oct 16, 2023 at 03:55:50PM -0700, Junio C Hamano wrote:
Show 10 quoted lines
> Jacob Stopak <jacob@initialcommit.io> writes: > > > builtin/bugreport.c | 83 +++++++++++++++++++++++++++++++-------------- > > 1 file changed, 57 insertions(+), 26 deletions(-) > > Looking good. It is not easy to do an automated and reliable test > for this one for obvious reasons ;-), so let's queue it as-is. > > Thanks. >
Awesome! Thank you!
Show 16 quoted lines
> > - /* fopen doesn't offer us an O_EXCL alternative, except with glibc. */
> > - report = xopen(report_path.buf, O_CREAT | O_EXCL | O_WRONLY, 0666);
> > + again:
> > + /* fopen doesn't offer us an O_EXCL alternative, except with glibc. */
> > + report = open(report_path.buf, O_CREAT | O_EXCL | O_WRONLY, 0666);
> > + if (report < 0 && errno == EEXIST && !option_suffix_is_from_user) {
> > + build_path(&report_path, prefixed_filename,
> > + "git-bugreport-", option_suffix, now, &i,
> > + ".txt");
> > + goto again;
> > + } else if (report < 0) {
> > + die_errno(_("unable to open '%s'"), report_path.buf);
> > + }
>
> I didn't expect a rewrite to add an extra level of indentation like
> this, though ;-).Whoops... I looked in another file to check the indentation around a goto label and misread how it should be. Let me know if I should submit v4 with that corrected.