On 2023-10-14 18:27, Junio C Hamano wrote:
Jacob Stopak <jacob@xxxxxxxxxxxxxxxx> writes:
If a user runs the bugreport command more than once within a calendar
minute, a filename conflict with an existing file occurs and the
program
errors, since the new output filename was already used for the
previous
file.
This is totally expected and you made an excellent observation.
I personally do not think it is a problem, simply because a quality
bug report that would capture information necessary to diagnose any
issue concisely in a readable fashion would take at least 90 seconds
or more to produce, though.
Instead of lengthening the filename for all files by 2 digits, the
command can retry by adding say "+1", "+2", etc. after the failed
filename to find a unique suffix within the same minute. It would
mean that after writing git-bugreport-2023-10-14-0920.txt and you
start another one without spending enough time, the new one may
become git-bugreport-2023-10-14-0920+1.txt or something unique.
How about making the filename a bit shorter first, to make room for the
additional two digits, so the example mentioned above would end up being
named "git-bugreport-20231014-092037.txt"?