remove init_pathspec() in favor of parse_pathspec()
While at there, move free_pathspec() to pathspec.c Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
bd1928df1d
commit
9a08727443
10
tree-diff.c
10
tree-diff.c
@ -195,7 +195,6 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
|
||||
struct diff_options diff_opts;
|
||||
struct diff_queue_struct *q = &diff_queued_diff;
|
||||
struct diff_filepair *choice;
|
||||
const char *paths[1];
|
||||
int i;
|
||||
|
||||
/*
|
||||
@ -228,8 +227,6 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
|
||||
diff_opts.single_follow = opt->pathspec.raw[0];
|
||||
diff_opts.break_opt = opt->break_opt;
|
||||
diff_opts.rename_score = opt->rename_score;
|
||||
paths[0] = NULL;
|
||||
init_pathspec(&diff_opts.pathspec, paths);
|
||||
diff_setup_done(&diff_opts);
|
||||
diff_tree(t1, t2, base, &diff_opts);
|
||||
diffcore_std(&diff_opts);
|
||||
@ -247,14 +244,17 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
|
||||
*/
|
||||
if ((p->status == 'R' || p->status == 'C') &&
|
||||
!strcmp(p->two->path, opt->pathspec.raw[0])) {
|
||||
const char *path[2];
|
||||
|
||||
/* Switch the file-pairs around */
|
||||
q->queue[i] = choice;
|
||||
choice = p;
|
||||
|
||||
/* Update the path we use from now on.. */
|
||||
path[0] = p->one->path;
|
||||
path[1] = NULL;
|
||||
free_pathspec(&opt->pathspec);
|
||||
opt->pathspec.raw[0] = xstrdup(p->one->path);
|
||||
init_pathspec(&opt->pathspec, opt->pathspec.raw);
|
||||
parse_pathspec(&opt->pathspec, PATHSPEC_ALL_MAGIC, 0, "", path);
|
||||
|
||||
/*
|
||||
* The caller expects us to return a set of vanilla
|
||||
|
Reference in New Issue
Block a user