8000 patch: add context lines accessor · libgit2/libgit2@2409c20 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2409c20

Browse files
author
Martin Marmsoler
committed
patch: add context lines accessor
1 parent 12b53eb commit 2409c20

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

include/git2/patch.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ typedef struct git_patch git_patch;
3636
*/
3737
GIT_EXTERN(git_repository *) git_patch_owner(const git_patch *patch);
3838

39+
/**
40+
* Get the context lines setting from the diff options.
41+
*
42+
* @param patch the patch
43+
* @return context lines setting
44+
*/
45+
GIT_EXTERN(int) git_patch_context_lines(const git_patch *patch);
46+
3947
/**
4048
* Return a patch for an entry in the diff list.
4149
*

src/patch.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ git_repository *git_patch_owner(const git_patch *patch)
209209
return patch->repo;
210210
}
211211

212+
int git_patch_context_lines(const git_patch *patch)
213+
{
214+
return patch->diff_opts.context_lines;
215+
}
216+
212217
int git_patch_from_diff(git_patch **out, git_diff *diff, size_t idx)
213218
{
214219
GIT_ASSERT_ARG(out);

0 commit comments

Comments
 (0)
0