-rw-r--r-- | shared.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -40,2 +40,3 @@ int cgit_cache_max_create_time = 5; int cgit_summary_log = 0; +int cgit_renamelimit = -1; @@ -184,2 +185,4 @@ void cgit_global_config_cb(const char *name, const char *value) cgit_agefile = xstrdup(value); + else if (!strcmp(name, "renamelimit")) + cgit_renamelimit = atoi(value); else if (!strcmp(name, "repo.group")) @@ -385,3 +388,3 @@ void cgit_diff_tree(const unsigned char *old_sha1, const unsigned char *new_sha1, - filepair_fn fn) + filepair_fn fn, const char *prefix) { @@ -389,2 +392,3 @@ void cgit_diff_tree(const unsigned char *old_sha1, int ret; + int prefixlen; @@ -393,2 +397,3 @@ void cgit_diff_tree(const unsigned char *old_sha1, opt.detect_rename = 1; + opt.rename_limit = cgit_renamelimit; opt.recursive = 1; @@ -396,2 +401,8 @@ void cgit_diff_tree(const unsigned char *old_sha1, opt.format_callback_data = fn; + if (prefix) { + opt.nr_paths = 1; + opt.paths = &prefix; + prefixlen = strlen(prefix); + opt.pathlens = &prefixlen; + } diff_setup_done(&opt); @@ -412,3 +423,3 @@ void cgit_diff_commit(struct commit *commit, filepair_fn fn) old_sha1 = commit->parents->item->object.sha1; - cgit_diff_tree(old_sha1, commit->object.sha1, fn); + cgit_diff_tree(old_sha1, commit->object.sha1, fn, NULL); } |