alexcouper / captainhook

Git hook scripts
BSD 3-Clause "New" or "Revised" License
54 stars 14 forks source link

Errors when unstashing stop commit from happening #36

Closed OddBloke closed 10 years ago

OddBloke commented 10 years ago

I'm hitting problems when I edit a hunk during an add -p; the stash that captainhook stores will fail to apply on pop (because it refers to a tree which won't exist after the commit happens).

This stops the commit from happening and it screws up my carefully crafted commit (I just spent a minute using very salty language; appropriate for captainhook) by causing a merge conflict.

I think we should output the stash pop error, but still commit if that's the only problem we have.

alexcouper commented 10 years ago

This requires some thought...

OddBloke commented 10 years ago

Yeah, irritating isn't it.

alexcouper commented 10 years ago

I suspect the solution for this lies in not doing the stash at all.

If I recall, the reason for the stash was so the checks are only performed on the files to be committed.

Potentially there's another way of getting the correct diff to be committed.

OddBloke commented 10 years ago

I think flake8 do it by creating a temporary copy of the files from the git index; not sure how much I like that solution though...

alexcouper commented 10 years ago

I'm working on this in branch 36_dont_stash

alexcouper commented 10 years ago

I've taken the copy-file-to-be-committed approach using git show :filename.

Only issue at the moment is that we get output which isn't exactly perfect:

===============================================================================
Checking flake8
===============================================================================
/var/folders/6b/ql76gbpn0wz53q4hl2bxg6lw0000gn/T/tmpp22eB8/captainhook/checkers/utils.py:58:1: E303 too many blank lines (3)
/var/folders/6b/ql76gbpn0wz53q4hl2bxg6lw0000gn/T/tmpp22eB8/captainhook/checkers/utils.py:91:1: E303 too many blank lines (3)
===============================================================================
Rejecting commit
===============================================================================

insert lolz for mac temp directories

alexcouper commented 10 years ago

I'm thinking that a better approach might be to: