Skip to content

Ability to re-run a commit if it fails #132

Closed

Description

@lricoy

Sometimes, when a pre_commit hook is configured, our commit will fail. It would be helpful to have a way to pass something like --retry so we won't need to enter the message again.

Activity

  1. jimthedev commented on Feb 8, 2016

    @jimthedev
    Member

    Good point. Since this is a cli, we don't really have any place to store this commit over time. Would it be just the last 1 commit that you'd want cached?

  2. lricoy commented on Feb 10, 2016

    @lricoy
    ContributorAuthor

    Yeah, at first that would be the case. The use case would be to re-run it after fixing the tests or coverage. If you want to give me some direction and tell me how or where to store it I may give it a try and add that functionality myself. Something like @kentcdodds wrote on his article.

  3. kentcdodds commented on Feb 10, 2016

    @kentcdodds
    Member

    I'd love this feature. Having to fill out the prompts again because of a long error is super annoying. I'd want it to show me the message before it commits though.

  4. jimthedev commented on Feb 10, 2016

    @jimthedev
    Member

    Where can we store this info? A text file cache in the repo? We'd need to add it to .gitignore but at least then the cash would go with the repo if it gets moved.

  5. kentcdodds commented on Feb 10, 2016

    @kentcdodds
    Member

    Yeah, put it in the repo and document the need to gitignore it

  6. self-assigned this
    on Mar 9, 2016
  7. jimthedev commented on Mar 10, 2016

    @jimthedev
    Member

    Gave it a bit more thought. We can do this simply by have a filesystem based cache in the user's home directory.

    The cache keys will be a paths to repo roots, the value will be a serialized command that was going to be executed. I will work on this soon. I think we can offer it w/o a breaking change or .gitignore changes. Sure if you move a folder around you'll lose the ability to use the retry command between moves, but that probably an ok tradeoff.

  8. kentcdodds commented on Mar 10, 2016

    @kentcdodds
    Member

    What if you used the temp directory instead? That way you don't put more stuff in the already-too-full user home...

  9. jimthedev commented on Mar 10, 2016

    @jimthedev
    Member

    I'm thinking of using home-or-tmp.
    On Wed, Mar 9, 2016 at 8:19 PM Kent C. Dodds notifications@github.com
    wrote:

    What if you used the temp directory instead? That way you don't put more
    stuff in the already-too-full user home...

    —
    Reply to this email directly or view it on GitHub
    #132 (comment).

  10. jimthedev commented on Mar 10, 2016

    @jimthedev
    Member

    This will be released as an undocumented feature in 2.7.0. I will add tests and docs in 2.7.1 but wanted to see if you folks could test it. You can use it but running git cz --retry.

  11. lricoy commented on Mar 10, 2016

    @lricoy
    ContributorAuthor

    I will take a look right away.

  12. jimthedev commented on Mar 10, 2016

    @jimthedev
    Member

    Looks like the node 0.12 build failed. @lricoy I'll have to look at it before 2.7.0 releases

  13. added a commit that references this issue on Mar 10, 2016
    96a80c8
  14. jimthedev commented on Mar 10, 2016

    @jimthedev
    Member

    Ok, looks like it was me just being dumb and forgetting that Object.assign isn't available in node 0.12. Using lodash's alternative for now. This fix is released as 2.7.1. Would appreciate any feedback!

  15. jimthedev commented on Mar 10, 2016

    @jimthedev
    Member

    This is in the docs as of f1c719f

  16. lricoy commented on Mar 11, 2016

    @lricoy
    ContributorAuthor

    It worked fine for me @jimthedev

  17. jimthedev commented on Mar 11, 2016

    @jimthedev
    Member

    @lricoy Great. Thanks!

  18. lricoy commented on Mar 11, 2016

    @lricoy
    ContributorAuthor

    One thing to note. If using from a npm script defined on package.json. The syntax required double --, as npm requires -- for passing args to npm run and the --retry being the argument itself:

    npm run commit -- --retry

    commit only being an alias to git-cz on node-modules/bin

      "scripts": {
          "commit": "git-cz",
      },
    
  19. kentcdodds commented on Mar 11, 2016

    @kentcdodds
    Member
  20. lricoy commented on Mar 11, 2016

    @lricoy
    ContributorAuthor

    Cool @kentcdodds . Thanks for the tip 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions