diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2016-06-25 16:15:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-25 16:15:00 +0200 |
commit | 4896fa2ccbd84553392e2a74af450d807e197783 (patch) | |
tree | 31e26349fd576696db156e96880f70ffdb7d95de /git/index/base.py | |
parent | 3c6e5adab98a2ea4253fefc4f83598947f4993ee (diff) | |
parent | e031a0ee8a6474154c780e31da2370a66d578cdc (diff) | |
download | gitpython-4896fa2ccbd84553392e2a74af450d807e197783.tar.gz |
Merge pull request #479 from peterbe/commit-without-executing-hooks
Commit without executing hooks, fixes #468
Diffstat (limited to 'git/index/base.py')
-rw-r--r-- | git/index/base.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/git/index/base.py b/git/index/base.py index 3e68f843..524b4568 100644 --- a/git/index/base.py +++ b/git/index/base.py @@ -931,19 +931,24 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): return out def commit(self, message, parent_commits=None, head=True, author=None, - committer=None, author_date=None, commit_date=None): + committer=None, author_date=None, commit_date=None, + skip_hooks=False): """Commit the current default index file, creating a commit object. For more information on the arguments, see tree.commit. :note: If you have manually altered the .entries member of this instance, don't forget to write() your changes to disk beforehand. + Passing skip_hooks=True is the equivalent of using `-n` + or `--no-verify` on the command line. :return: Commit object representing the new commit""" - run_commit_hook('pre-commit', self) + if not skip_hooks: + run_commit_hook('pre-commit', self) tree = self.write_tree() rval = Commit.create_from_tree(self.repo, tree, message, parent_commits, head, author=author, committer=committer, author_date=author_date, commit_date=commit_date) - run_commit_hook('post-commit', self) + if not skip_hooks: + run_commit_hook('post-commit', self) return rval @classmethod |