Do not delete temporary files if git send-email fails
lheckemann opened this issue · 2 comments
I lost a bunch of work documenting a patch after git send-email
failed (because it didn't exist in the Git distribution I was using). send-email
can fail for a number of other reasons, so this should be handled a little more gracefully by git-publish.
I will probably submit a patch for this at some point if nobody else beats me to it :)
Hi Linus,
Sorry you lost work! There is a -staging tag that is created before git-send-email(1) is run. It contains the cover letter you wrote and will be restored next time you run git-publish.
Changes made to the individual email files are always deleted:
except (GitSendEmailError, GitHookError, InspectEmailsError):
return 1
except GitError as e:
print(e)
return 1
finally:
if tmpdir:
shutil.rmtree(tmpdir)
Perhaps a message should be printed reminding the user of the temporary directory so they can decide whether to delete it manually or recover their work. It may also be possible to add an option to git-publish that starts with the user's existing email directory.
It contains the cover letter you wrote and will be restored next time you run git-publish.
Somehow it wasn't :/