diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2015-01-12 14:55:31 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2015-01-12 14:55:31 +0100 |
commit | e8eae18dcc360e6ab96c2291982bd4306adc01b9 (patch) | |
tree | 804cc52c1a9976a7274000d9a446bae2b4f032b3 /git/index/base.py | |
parent | e7671110bc865786ffe61cf9b92bf43c03759229 (diff) | |
download | gitpython-e8eae18dcc360e6ab96c2291982bd4306adc01b9.tar.gz |
IndexFile.commit() now runs pre-commit and post-commit hooks.
However, it does so only on posix. The test-case will run on posix only
as well.
Please note that in theory, even on windows we will attempt to run hooks,
even though I am not sure that this will actually work.
Fixes #81
Diffstat (limited to 'git/index/base.py')
-rw-r--r-- | git/index/base.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/git/index/base.py b/git/index/base.py index db0c3cda..7002385c 100644 --- a/git/index/base.py +++ b/git/index/base.py @@ -63,7 +63,8 @@ from .fun import ( aggressive_tree_merge, write_tree_from_cache, stat_mode_to_index_mode, - S_IFGITLINK + S_IFGITLINK, + run_commit_hook ) from gitdb.base import IStream @@ -893,9 +894,12 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): :note: If you have manually altered the .entries member of this instance, don't forget to write() your changes to disk beforehand. :return: Commit object representing the new commit""" + run_commit_hook('pre-commit', self) tree = self.write_tree() - return Commit.create_from_tree(self.repo, tree, message, parent_commits, + rval = Commit.create_from_tree(self.repo, tree, message, parent_commits, head, author=author, committer=committer) + run_commit_hook('post-commit', self) + return rval @classmethod def _flush_stdin_and_wait(cls, proc, ignore_stdout=False): |