git-publish icon indicating copy to clipboard operation
git-publish copied to clipboard

Do not delete temporary files if git send-email fails

Open lheckemann opened this issue 2 years ago • 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 :)

lheckemann avatar Oct 11 '22 10:10 lheckemann

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.

stefanha avatar Oct 12 '22 14:10 stefanha

It contains the cover letter you wrote and will be restored next time you run git-publish.

Somehow it wasn't :/

lheckemann avatar Oct 14 '22 14:10 lheckemann