summaryrefslogtreecommitdiff
path: root/examples/diff.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-11-14 23:29:48 -0800
committerRussell Belfer <rb@github.com>2012-11-14 23:29:48 -0800
commitbbe6dbec81d2050fb52b600bc27e2dacdc780e77 (patch)
tree61f442146ed5b98352016f4ecec3ac4736e10c8c /examples/diff.c
parentbad68c0a998116685ad75cab84210004dd2c5be1 (diff)
downloadlibgit2-bbe6dbec81d2050fb52b600bc27e2dacdc780e77.tar.gz
Add explicit git_index ptr to diff and checkout
A number of diff APIs and the `git_checkout_index` API take a `git_repository` object an operate on the index. This updates them to take a `git_index` pointer explicitly and only fall back on the `git_repository` index if the index input is NULL. This makes it easier to operate on a temporary index.
Diffstat (limited to 'examples/diff.c')
-rw-r--r--examples/diff.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/diff.c b/examples/diff.c
index 31ebf6bfb..38231d219 100644
--- a/examples/diff.c
+++ b/examples/diff.c
@@ -204,22 +204,22 @@ int main(int argc, char *argv[])
/* nothing */
if (t1 && t2)
- check(git_diff_tree_to_tree(repo, &opts, t1, t2, &diff), "Diff");
+ check(git_diff_tree_to_tree(&diff, repo, t1, t2, &opts), "Diff");
else if (t1 && cached)
- check(git_diff_index_to_tree(repo, &opts, t1, &diff), "Diff");
+ check(git_diff_index_to_tree(&diff, repo, t1, NULL, &opts), "Diff");
else if (t1) {
git_diff_list *diff2;
- check(git_diff_index_to_tree(repo, &opts, t1, &diff), "Diff");
- check(git_diff_workdir_to_index(repo, &opts, &diff2), "Diff");
+ 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_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(repo, &opts, t1, &diff), "Diff");
+ check(git_diff_index_to_tree(&diff, repo, t1, NULL, &opts), "Diff");
}
else
- check(git_diff_workdir_to_index(repo, &opts, &diff), "Diff");
+ check(git_diff_workdir_to_index(&diff, repo, NULL, &opts), "Diff");
if (color >= 0)
fputs(colors[0], stdout);