2020
2121static int write_revert_head (
2222 git_repository * repo ,
23- const git_commit * commit ,
2423 const char * commit_oidstr )
2524{
2625 git_filebuf file = GIT_FILEBUF_INIT ;
2726 git_buf file_path = GIT_BUF_INIT ;
2827 int error = 0 ;
2928
30- assert (repo && commit );
31-
3229 if ((error = git_buf_joinpath (& file_path , repo -> path_repository , GIT_REVERT_HEAD_FILE )) >= 0 &&
3330 (error = git_filebuf_open (& file , file_path .ptr , GIT_FILEBUF_FORCE , GIT_REVERT_FILE_MODE )) >= 0 &&
3431 (error = git_filebuf_printf (& file , "%s\n" , commit_oidstr )) >= 0 )
@@ -44,16 +41,13 @@ static int write_revert_head(
4441
4542static int write_merge_msg (
4643 git_repository * repo ,
47- const git_commit * commit ,
4844 const char * commit_oidstr ,
4945 const char * commit_msgline )
5046{
5147 git_filebuf file = GIT_FILEBUF_INIT ;
5248 git_buf file_path = GIT_BUF_INIT ;
5349 int error = 0 ;
5450
55- assert (repo && commit );
56-
5751 if ((error = git_buf_joinpath (& file_path , repo -> path_repository , GIT_MERGE_MSG_FILE )) < 0 ||
5852 (error = git_filebuf_open (& file , file_path .ptr , GIT_FILEBUF_FORCE , GIT_REVERT_FILE_MODE )) < 0 ||
5953 (error = git_filebuf_printf (& file , "Revert \"%s\"\n\nThis reverts commit %s.\n" ,
@@ -198,8 +192,8 @@ int git_revert(
198192
199193 if ((error = git_buf_printf (& their_label , "parent of %.7s... %s" , commit_oidstr , commit_msg )) < 0 ||
200194 (error = revert_normalize_opts (repo , & opts , given_opts , git_buf_cstr (& their_label ))) < 0 ||
201- (error = write_revert_head (repo , commit , commit_oidstr )) < 0 ||
202- (error = write_merge_msg (repo , commit , commit_oidstr , commit_msg )) < 0 ||
195+ (error = write_revert_head (repo , commit_oidstr )) < 0 ||
196+ (error = write_merge_msg (repo , commit_oidstr , commit_msg )) < 0 ||
203197 (error = git_repository_head (& our_ref , repo )) < 0 ||
204198 (error = git_reference_peel ((git_object * * )& our_commit , our_ref , GIT_OBJ_COMMIT )) < 0 ||
205199 (error = git_revert_commit (& index_new , repo , commit , our_commit , opts .mainline , & opts .merge_tree_opts )) < 0 ||
0 commit comments