From e8eae18dcc360e6ab96c2291982bd4306adc01b9 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 12 Jan 2015 14:55:31 +0100 Subject: 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 --- git/index/base.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'git/index/base.py') 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): -- cgit v1.2.3