commit-comments icon indicating copy to clipboard operation
commit-comments copied to clipboard

Leave repository in clean state after commit

Open hauleth opened this issue 8 years ago • 2 comments

This will clean repository state after commit removing all @commit from diff.

hauleth avatar Jan 16 '16 02:01 hauleth

Oh this is great! Let run some tests quickly.

Thank you so much for this! Leaving the repository littered with changes to stage was not the best.

jryio avatar Jan 16 '16 02:01 jryio

@hauleth One issue I am having is that once a commit is complete, the git commit command hangs for 100+ seconds.

That is, once you write your commit and close the editor, the process does not quit immediately after completing the post-commit hook with the added changes from this PR.

Here is the output I got after letting git commit run for about 2 minutes. Side note: I titled my commit Another test, do not add

.git/hooks/prepare-commit-msg: fork: Resource temporarily unavailable
.git/hooks/prepare-commit-msg: fork: Resource temporarily unavailable
.git/hooks/prepare-commit-msg: fork: Resource temporarily unavailable
.git/hooks/prepare-commit-msg: fork: Resource temporarily unavailable
.git/hooks/prepare-commit-msg: fork: Resource temporarily unavailable
.git/hooks/prepare-commit-msg: fork: Resource temporarily unavailable
.git/hooks/prepare-commit-msg: fork: Resource temporarily unavailable
[hauleth-amend 53cf509] Another test, do not add
 Date: Fri Jan 15 20:56:46 2016 -0800
 4 files changed, 23 insertions(+), 21 deletions(-)
[hauleth-amend 53cf509] Another test, do not add
 Date: Fri Jan 15 20:56:46 2016 -0800
 4 files changed, 23 insertions(+), 21 deletions(-)
[hauleth-amend 00028c9] Another test, do not add
 Date: Fri Jan 15 20:56:46 2016 -0800
 4 files changed, 23 insertions(+), 21 deletions(-)
[hauleth-amend 00028c9] Another test, do not add
 Date: Fri Jan 15 20:56:46 2016 -0800

# I cut out about 1,000 repetitions

 4 files changed, 23 insertions(+), 21 deletions(-)
[hauleth-amend 94da598] Another test, do not add
 Date: Fri Jan 15 20:56:46 2016 -0800
 4 files changed, 23 insertions(+), 21 deletions(-)
[hauleth-amend 03f8d6b] Another test, do not add
 Date: Fri Jan 15 20:56:46 2016 -0800
 4 files changed, 23 insertions(+), 21 deletions(-)
[hauleth-amend 4c8dd4b] Another test, do not add
 1 file changed, 2 insertions(+)

This might be caused by how Bash implements the @ operator for lists when using "${ADDED_FILES[@]}" - I will look into this.

For reference I am running a zsh terminal session, using Git version 2.6.3 and using Vim as my commit editor.

jryio avatar Jan 16 '16 05:01 jryio