@@ -931,19 +931,24 @@ def move(self, items, skip_errors=False, **kwargs):
931
931
return out
932
932
933
933
def commit (self , message , parent_commits = None , head = True , author = None ,
934
- committer = None , author_date = None , commit_date = None ):
934
+ committer = None , author_date = None , commit_date = None ,
935
+ skip_hooks = False ):
935
936
"""Commit the current default index file, creating a commit object.
936
937
For more information on the arguments, see tree.commit.
937
938
938
939
:note: If you have manually altered the .entries member of this instance,
939
940
don't forget to write() your changes to disk beforehand.
941
+ Passing skip_hooks=True is the equivalent of using `-n`
942
+ or `--no-verify` on the command line.
940
943
:return: Commit object representing the new commit"""
941
- run_commit_hook ('pre-commit' , self )
944
+ if not skip_hooks :
945
+ run_commit_hook ('pre-commit' , self )
942
946
tree = self .write_tree ()
943
947
rval = Commit .create_from_tree (self .repo , tree , message , parent_commits ,
944
948
head , author = author , committer = committer ,
945
949
author_date = author_date , commit_date = commit_date )
946
- run_commit_hook ('post-commit' , self )
950
+ if not skip_hooks :
951
+ run_commit_hook ('post-commit' , self )
947
952
return rval
948
953
949
954
@classmethod
0 commit comments