idetect copies and renames based on the threshold of changes - stagit-gopher - A git gopher frontend. (mirror) Err bitreich.org 70 hgit clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/stagit-gopher/ URL:git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/stagit-gopher/ bitreich.org 70 1Log /scm/stagit-gopher/log.gph bitreich.org 70 1Files /scm/stagit-gopher/files.gph bitreich.org 70 1Refs /scm/stagit-gopher/refs.gph bitreich.org 70 1Tags /scm/stagit-gopher/tag bitreich.org 70 1README /scm/stagit-gopher/file/README.gph bitreich.org 70 1LICENSE /scm/stagit-gopher/file/LICENSE.gph bitreich.org 70 i--- Err bitreich.org 70 1commit 3a00e5bb2bf0415338ff08d1a7bc9a47b4b751e2 /scm/stagit-gopher/commit/3a00e5bb2bf0415338ff08d1a7bc9a47b4b751e2.gph bitreich.org 70 1parent 8bad0e073142b1347085d04646fd64e11a7a7c2a /scm/stagit-gopher/commit/8bad0e073142b1347085d04646fd64e11a7a7c2a.gph bitreich.org 70 hAuthor: Hiltjo Posthuma URL:mailto:hiltjo@codemadness.org bitreich.org 70 iDate: Sun, 11 Nov 2018 18:57:50 +0100 Err bitreich.org 70 i Err bitreich.org 70 idetect copies and renames based on the threshold of changes Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i M stagit-gopher.c | 9 +++++++++ Err bitreich.org 70 i Err bitreich.org 70 i1 file changed, 9 insertions(+), 0 deletions(-) Err bitreich.org 70 i--- Err bitreich.org 70 1diff --git a/stagit-gopher.c b/stagit-gopher.c /scm/stagit-gopher/file/stagit-gopher.c.gph bitreich.org 70 i@@ -140,6 +140,7 @@ commitinfo_getstats(struct commitinfo *ci) Err bitreich.org 70 i { Err bitreich.org 70 i struct deltainfo *di; Err bitreich.org 70 i git_diff_options opts; Err bitreich.org 70 i+ git_diff_find_options fopts; Err bitreich.org 70 i const git_diff_delta *delta; Err bitreich.org 70 i const git_diff_hunk *hunk; Err bitreich.org 70 i const git_diff_line *line; Err bitreich.org 70 i@@ -161,6 +162,12 @@ commitinfo_getstats(struct commitinfo *ci) Err bitreich.org 70 i if (git_diff_tree_to_tree(&(ci->diff), repo, ci->parent_tree, ci->commit_tree, &opts)) Err bitreich.org 70 i goto err; Err bitreich.org 70 i Err bitreich.org 70 i+ if (git_diff_find_init_options(&fopts, GIT_DIFF_FIND_OPTIONS_VERSION)) Err bitreich.org 70 i+ goto err; Err bitreich.org 70 i+ fopts.flags |= GIT_DIFF_FIND_RENAMES | GIT_DIFF_FIND_COPIES; Err bitreich.org 70 i+ if (git_diff_find_similar(ci->diff, &fopts)) Err bitreich.org 70 i+ goto err; Err bitreich.org 70 i+ Err bitreich.org 70 i ndeltas = git_diff_num_deltas(ci->diff); Err bitreich.org 70 i if (ndeltas && !(ci->deltas = calloc(ndeltas, sizeof(struct deltainfo *)))) Err bitreich.org 70 i err(1, "calloc"); Err bitreich.org 70 i@@ -168,6 +175,7 @@ commitinfo_getstats(struct commitinfo *ci) Err bitreich.org 70 i for (i = 0; i < ndeltas; i++) { Err bitreich.org 70 i if (git_patch_from_diff(&patch, ci->diff, i)) Err bitreich.org 70 i goto err; Err bitreich.org 70 i+ Err bitreich.org 70 i if (!(di = calloc(1, sizeof(struct deltainfo)))) Err bitreich.org 70 i err(1, "calloc"); Err bitreich.org 70 i di->patch = patch; Err bitreich.org 70 i@@ -567,6 +575,7 @@ printshowfile(FILE *fp, struct commitinfo *ci) Err bitreich.org 70 i fputs("Diffstat:\n", fp); Err bitreich.org 70 i for (i = 0; i < ci->ndeltas; i++) { Err bitreich.org 70 i delta = git_patch_get_delta(ci->deltas[i]->patch); Err bitreich.org 70 i+ Err bitreich.org 70 i if (strcmp(delta->old_file.path, delta->new_file.path)) { Err bitreich.org 70 i snprintf(filename, sizeof(filename), "%s -> %s", Err bitreich.org 70 i delta->old_file.path, delta->new_file.path); Err bitreich.org 70 .