Skip to content

Stash unstaged changes before running pylint#37

Merged
sebdah merged 1 commit intosebdah:masterfrom
evanunderscore:stash-unstaged
Feb 26, 2016
Merged

Stash unstaged changes before running pylint#37
sebdah merged 1 commit intosebdah:masterfrom
evanunderscore:stash-unstaged

Conversation

@evanunderscore
Copy link
Contributor

Addresses issue #26. Unstaged changes are stashed using git stash --keep-index before running any tests, then restored using git reset --hard and git stash pop --index afterwards. Untracked files are left untouched. Note that git stash doesn't work if there is no initial commit, so in this case it prints a warning then behaves as it did previously.

@sebdah sebdah self-assigned this Aug 6, 2015
@sebdah
Copy link
Owner

sebdah commented Aug 6, 2015

Thanks for this PR. I'm gonna review it.

@sebdah sebdah added this to the 2.1.x milestone Aug 6, 2015
@evanunderscore
Copy link
Contributor Author

@sebdah Any chance you could take a look at this? I promise the diff isn't as scary as it looks; most of it is just indenting code 4 spaces to put it under the context manager. I haven't fixed the merge conflicts yet since if you decide you don't like the overall approach I'm taking there may be no point. Let me know if you'd prefer me to fix those first.

@sebdah
Copy link
Owner

sebdah commented Feb 20, 2016

@evanunderscore I'm fine with this PR, so if you get the conflicts resolved, I'll merge it.

@evanunderscore
Copy link
Contributor Author

@sebdah Thanks, done. Build failure seems to be due to something dropping support for 3.2 (see travis-ci/travis-ci#5517).

@sebdah sebdah merged commit a2e41a5 into sebdah:master Feb 26, 2016
@hjc
Copy link

hjc commented Mar 30, 2016

Just want to chime in and say that I run my own stash and pop before running git-pylint-commit-hook (not all my tools are nice enough to do this for me), using the same strategy outlined here. The two don't seem to conflict in the slightest and my hooks work, no extra stashes are made, no stashes are popped at the wrong time, no stashes are dropped, etc.

Didn't notice a test for this very situation, so wanted to provide some anecdotal evidence. Thanks guys! Looks like a solid implementation!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants