mirror of
https://github.com/git/git.git
synced 2026-01-08 09:13:48 +00:00
Merge branch 'rs/diff-index-find-copies-harder-optim'
Halve the memory consumed by artificial filepairs created during "git diff --find-copioes-harder", also making the operation run faster. * rs/diff-index-find-copies-harder-optim: diff-index: don't queue unchanged filepairs with diff_change()
This commit is contained in:
13
diff-lib.c
13
diff-lib.c
@@ -418,13 +418,12 @@ static int show_modified(struct rev_info *revs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
oldmode = old_entry->ce_mode;
|
oldmode = old_entry->ce_mode;
|
||||||
if (mode == oldmode && oideq(oid, &old_entry->oid) && !dirty_submodule &&
|
if (mode != oldmode || !oideq(oid, &old_entry->oid) || dirty_submodule)
|
||||||
!revs->diffopt.flags.find_copies_harder)
|
diff_change(&revs->diffopt, oldmode, mode,
|
||||||
return 0;
|
&old_entry->oid, oid, 1, !is_null_oid(oid),
|
||||||
|
old_entry->name, 0, dirty_submodule);
|
||||||
diff_change(&revs->diffopt, oldmode, mode,
|
else if (revs->diffopt.flags.find_copies_harder)
|
||||||
&old_entry->oid, oid, 1, !is_null_oid(oid),
|
diff_same(&revs->diffopt, mode, oid, old_entry->name);
|
||||||
old_entry->name, 0, dirty_submodule);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
20
diff.c
20
diff.c
@@ -7399,6 +7399,26 @@ void diff_change(struct diff_options *options,
|
|||||||
concatpath, old_dirty_submodule, new_dirty_submodule);
|
concatpath, old_dirty_submodule, new_dirty_submodule);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void diff_same(struct diff_options *options,
|
||||||
|
unsigned mode,
|
||||||
|
const struct object_id *oid,
|
||||||
|
const char *concatpath)
|
||||||
|
{
|
||||||
|
struct diff_filespec *one;
|
||||||
|
|
||||||
|
if (S_ISGITLINK(mode) && is_submodule_ignored(concatpath, options))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (options->prefix &&
|
||||||
|
strncmp(concatpath, options->prefix, options->prefix_length))
|
||||||
|
return;
|
||||||
|
|
||||||
|
one = alloc_filespec(concatpath);
|
||||||
|
fill_filespec(one, oid, 1, mode);
|
||||||
|
one->count++;
|
||||||
|
diff_queue(&diff_queued_diff, one, one);
|
||||||
|
}
|
||||||
|
|
||||||
struct diff_filepair *diff_unmerge(struct diff_options *options, const char *path)
|
struct diff_filepair *diff_unmerge(struct diff_options *options, const char *path)
|
||||||
{
|
{
|
||||||
struct diff_filepair *pair;
|
struct diff_filepair *pair;
|
||||||
|
|||||||
5
diff.h
5
diff.h
@@ -572,6 +572,11 @@ void diff_change(struct diff_options *,
|
|||||||
const char *fullpath,
|
const char *fullpath,
|
||||||
unsigned dirty_submodule1, unsigned dirty_submodule2);
|
unsigned dirty_submodule1, unsigned dirty_submodule2);
|
||||||
|
|
||||||
|
void diff_same(struct diff_options *,
|
||||||
|
unsigned mode,
|
||||||
|
const struct object_id *oid,
|
||||||
|
const char *fullpath);
|
||||||
|
|
||||||
struct diff_filepair *diff_unmerge(struct diff_options *, const char *path);
|
struct diff_filepair *diff_unmerge(struct diff_options *, const char *path);
|
||||||
|
|
||||||
void compute_diffstat(struct diff_options *options, struct diffstat_t *diffstat,
|
void compute_diffstat(struct diff_options *options, struct diffstat_t *diffstat,
|
||||||
|
|||||||
Reference in New Issue
Block a user