stefanha / git-publish

Prepare and store patch revisions as git tags
MIT License
133 stars 35 forks source link

Do not delete temporary files if git send-email fails #115

Open lheckemann opened 2 years ago

lheckemann commented 2 years ago

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 :)

stefanha commented 2 years ago

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.

lheckemann commented 2 years ago

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

Somehow it wasn't :/