summaryrefslogtreecommitdiff
path: root/examples/diff.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/diff.c')
-rw-r--r--examples/diff.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/diff.c b/examples/diff.c
index b81a8682a..63956aa4e 100644
--- a/examples/diff.c
+++ b/examples/diff.c
@@ -110,12 +110,12 @@ static int check_uint16_param(const char *arg, const char *pattern, uint16_t *va
return 1;
}
-static int check_str_param(const char *arg, const char *pattern, char **val)
+static int check_str_param(const char *arg, const char *pattern, const char **val)
{
size_t len = strlen(pattern);
if (strncmp(arg, pattern, len))
return 0;
- *val = (char *)(arg + len);
+ *val = (const char *)(arg + len);
return 1;
}
@@ -206,20 +206,20 @@ int main(int argc, char *argv[])
if (t1 && t2)
check(git_diff_tree_to_tree(&diff, repo, t1, t2, &opts), "Diff");
else if (t1 && cached)
- check(git_diff_index_to_tree(&diff, repo, t1, NULL, &opts), "Diff");
+ check(git_diff_tree_to_index(&diff, repo, t1, NULL, &opts), "Diff");
else if (t1) {
git_diff_list *diff2;
- check(git_diff_index_to_tree(&diff, repo, t1, NULL, &opts), "Diff");
- check(git_diff_workdir_to_index(&diff2, repo, NULL, &opts), "Diff");
+ check(git_diff_tree_to_index(&diff, repo, t1, NULL, &opts), "Diff");
+ check(git_diff_index_to_workdir(&diff2, repo, NULL, &opts), "Diff");
check(git_diff_merge(diff, diff2), "Merge diffs");
git_diff_list_free(diff2);
}
else if (cached) {
check(resolve_to_tree(repo, "HEAD", &t1), "looking up HEAD");
- check(git_diff_index_to_tree(&diff, repo, t1, NULL, &opts), "Diff");
+ check(git_diff_tree_to_index(&diff, repo, t1, NULL, &opts), "Diff");
}
else
- check(git_diff_workdir_to_index(&diff, repo, NULL, &opts), "Diff");
+ check(git_diff_index_to_workdir(&diff, repo, NULL, &opts), "Diff");
if (color >= 0)
fputs(colors[0], stdout);