diff options
author | Jason Haslam <jason@scitools.com> | 2016-11-14 16:52:33 -0700 |
---|---|---|
committer | KOLANICH <kolan_n@mail.ru> | 2020-12-11 16:12:00 +0300 |
commit | 58d757b1d36f5744e969852a54d34990a44c6389 (patch) | |
tree | 6bae7a7efb7091944c4eb650b5473cc6b02fde96 | |
parent | 03ea04bfacc601c9d573fabf4c1da3f9f85e148c (diff) | |
download | libgit2-58d757b1d36f5744e969852a54d34990a44c6389.tar.gz |
patch: add owner accessor
-rw-r--r-- | include/git2/patch.h | 8 | ||||
-rw-r--r-- | src/patch.c | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/include/git2/patch.h b/include/git2/patch.h index b177798e6..fde9659e7 100644 --- a/include/git2/patch.h +++ b/include/git2/patch.h @@ -29,6 +29,14 @@ GIT_BEGIN_DECL typedef struct git_patch git_patch; /** + * Get the repository associated with this patch. May be NULL. + * + * @param patch the patch + * @return a pointer to the repository + */ +GIT_EXTERN(git_repository *) git_patch_owner(const git_patch *patch); + +/** * Return a patch for an entry in the diff list. * * The `git_patch` is a newly created object contains the text diffs diff --git a/src/patch.c b/src/patch.c index 8f8bd7a08..f02c928de 100644 --- a/src/patch.c +++ b/src/patch.c @@ -204,6 +204,11 @@ int git_patch_get_line_in_hunk( return 0; } +git_repository *git_patch_owner(const git_patch *patch) +{ + return patch->repo; +} + int git_patch_from_diff(git_patch **out, git_diff *diff, size_t idx) { GIT_ASSERT_ARG(out); |