diff options
author | Russell Belfer <rb@github.com> | 2012-12-17 11:00:53 -0800 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2012-12-17 11:00:53 -0800 |
commit | 56c72b759c3adb92c0fdab18fccfb25fb561cd4f (patch) | |
tree | 9721502f41527e61265ae56940d30fddd5db9672 /examples/diff.c | |
parent | f79535092d86b531793640834bb010fa67dd4c3c (diff) | |
download | libgit2-56c72b759c3adb92c0fdab18fccfb25fb561cd4f.tar.gz |
Fix diff constructor name order confusion
The diff constructor functions had some confusing names, where the
"old" side of the diff was coming after the "new" side. This
reverses the order in the function name to make it less confusing.
Specifically...
* git_diff_index_to_tree becomes git_diff_tree_to_index
* git_diff_workdir_to_index becomes git_diff_index_to_workdir
* git_diff_workdir_to_tree becomes git_diff_tree_to_workdir
Diffstat (limited to 'examples/diff.c')
-rw-r--r-- | examples/diff.c | 14 |
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); |