@@ -931,19 +931,24 @@ def move(self, items, skip_errors=False, **kwargs):
931931 return out
932932
933933 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 ):
935936 """Commit the current default index file, creating a commit object.
936937 For more information on the arguments, see tree.commit.
937938
938939 :note: If you have manually altered the .entries member of this instance,
939940 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.
940943 :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 )
942946 tree = self .write_tree ()
943947 rval = Commit .create_from_tree (self .repo , tree , message , parent_commits ,
944948 head , author = author , committer = committer ,
945949 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 )
947952 return rval
948953
949954 @classmethod
0 commit comments