File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -3314,6 +3314,25 @@ int git_repository_set_bare(git_repository *repo)
3314
3314
return 0 ;
3315
3315
}
3316
3316
3317
+ int git_repository_head_commit (git_commit * * commit , git_repository * repo )
3318
+ {
3319
+ git_reference * head ;
3320
+ git_object * obj ;
3321
+ int error ;
3322
+
3323
+ if ((error = git_repository_head (& head , repo )) < 0 )
3324
+ return error ;
3325
+
3326
+ if ((error = git_reference_peel (& obj , head , GIT_OBJECT_COMMIT )) < 0 )
3327
+ goto cleanup ;
3328
+
3329
+ * commit = (git_commit * )obj ;
3330
+
3331
+ cleanup :
3332
+ git_reference_free (head );
3333
+ return error ;
3334
+ }
3335
+
3317
3336
int git_repository_head_tree (git_tree * * tree , git_repository * repo )
3318
3337
{
3319
3338
git_reference * head ;
Original file line number Diff line number Diff line change @@ -173,6 +173,7 @@ GIT_INLINE(git_attr_cache *) git_repository_attr_cache(git_repository *repo)
173
173
return repo -> attrcache ;
174
174
}
175
175
176
+ int git_repository_head_commit (git_commit * * commit , git_repository * repo );
176
177
int git_repository_head_tree (git_tree * * tree , git_repository * repo );
177
178
int git_repository_create_head (const char * git_dir , const char * ref_name );
178
179
You can’t perform that action at this time.
0 commit comments