send-email: detect and offer to skip backup files
commit531220ba500168bc5a2080df24dfd61705cafa3c
authorJunio C Hamano <gitster@pobox.com>
Fri, 18 Mar 2016 05:40:05 +0000 (17 22:40 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 13 Apr 2016 01:45:45 +0000 (12 18:45 -0700)
treeec9c2f1bb9a4effe48a794ac04eec695080b830a
parent937978e0f3e750d917768c77665d5f8cfbd802b6
send-email: detect and offer to skip backup files

Diligent people save output from format-patch to files, proofread
and edit them and then finally send the result out.  If the
resulting files are sent out with "git send-email 0*", this ends up
sending backup files (e.g. 0001-X.patch.backup or 0001-X.patch~)
left by their editors next to the final version.  Sending them with
"git send-email 0*.patch" (if format-patch was run with the standard
suffix) would avoid such an embarrassment, but not everybody is
careful.

After collecting files to be sent (and sorting them if read from a
directory), notice when the file being sent out has the same name as
the previous file, plus some suffix (e.g. 0001-X.patch was sent, and
we are looking at 0001-X.patch.backup or 0001-X.patch~), and the
suffix begins with a non-alnum (e.g. ".backup" or "~") and ask if
the user really wants to send it out.  Once the user skips sending
such a "backup" file, remember the suffix and stop asking the same
question (e.g. after skipping 0001-X.patch~, skip 0002-Y.patch~
without asking).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-send-email.perl