Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-10-16 02:10:07 +0400
committerRussell Belfer <rb@github.com>2013-10-16 02:10:07 +0400
commit10672e3e455eba2d4ca983070ed427caeeb24a6f (patch)
treee812af06091362849e9ecd279c5547e401cb0862 /src/diff_patch.c
parent3ff1d123736e5686fb9ec16e65828d5b8ffa2b30 (diff)
Diff API cleanup
This lays groundwork for separating formatting options from diff creation options. This groups the formatting flags separately from the diff list creation flags and reorders the options. This also tweaks some APIs to further separate code that uses patches from code that just looks at git_diffs.
Diffstat (limited to 'src/diff_patch.c')
-rw-r--r--src/diff_patch.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/diff_patch.c b/src/diff_patch.c
index a106944c7..951368200 100644
--- a/src/diff_patch.c
+++ b/src/diff_patch.c
@@ -17,7 +17,9 @@ typedef struct diff_patch_line diff_patch_line;
struct diff_patch_line {
const char *ptr;
size_t len;
- size_t lines, oldno, newno;
+ size_t lines;
+ size_t oldno;
+ size_t newno;
char origin;
};
@@ -109,9 +111,7 @@ static int diff_patch_init_from_diff(
}
static int diff_patch_alloc_from_diff(
- git_patch **out,
- git_diff *diff,
- size_t delta_index)
+ git_patch **out, git_diff *diff, size_t delta_index)
{
int error;
git_patch *patch = git__calloc(1, sizeof(git_patch));
@@ -605,10 +605,7 @@ int git_patch_from_blob_and_buffer(
}
int git_patch_from_diff(
- git_patch **patch_ptr,
- const git_diff_delta **delta_ptr,
- git_diff *diff,
- size_t idx)
+ git_patch **patch_ptr, git_diff *diff, size_t idx)
{
int error = 0;
git_xdiff_output xo;
@@ -616,7 +613,6 @@ int git_patch_from_diff(
git_patch *patch = NULL;
if (patch_ptr) *patch_ptr = NULL;
- if (delta_ptr) *delta_ptr = NULL;
if (diff_required(diff, "git_patch_from_diff") < 0)
return -1;
@@ -627,9 +623,6 @@ int git_patch_from_diff(
return GIT_ENOTFOUND;
}
- if (delta_ptr)
- *delta_ptr = delta;
-
if (git_diff_delta__should_skip(&diff->opts, delta))
return 0;
@@ -671,7 +664,7 @@ void git_patch_free(git_patch *patch)
GIT_REFCOUNT_DEC(patch, diff_patch_free);
}
-const git_diff_delta *git_patch_delta(git_patch *patch)
+const git_diff_delta *git_patch_get_delta(git_patch *patch)
{
assert(patch);
return patch->delta;