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
This commit is contained in:
Russell Belfer
2012-12-17 11:00:53 -08:00
parent f79535092d
commit 56c72b759c
11 changed files with 107 additions and 90 deletions

View File

@@ -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);