Merge branch 'nd/the-index'
Various codepaths in the core-ish part learn to work on an arbitrary in-core index structure, not necessarily the default instance "the_index". * nd/the-index: (23 commits) revision.c: reduce implicit dependency the_repository revision.c: remove implicit dependency on the_index ws.c: remove implicit dependency on the_index tree-diff.c: remove implicit dependency on the_index submodule.c: remove implicit dependency on the_index line-range.c: remove implicit dependency on the_index userdiff.c: remove implicit dependency on the_index rerere.c: remove implicit dependency on the_index sha1-file.c: remove implicit dependency on the_index patch-ids.c: remove implicit dependency on the_index merge.c: remove implicit dependency on the_index merge-blobs.c: remove implicit dependency on the_index ll-merge.c: remove implicit dependency on the_index diff-lib.c: remove implicit dependency on the_index read-cache.c: remove implicit dependency on the_index diff.c: remove implicit dependency on the_index grep.c: remove implicit dependency on the_index diff.c: remove the_index dependency in textconv() functions blame.c: rename "repo" argument to "r" combine-diff.c: remove implicit dependency on the_index ...
This commit is contained in:
@ -5,7 +5,8 @@
|
||||
#include "diff.h"
|
||||
#include "diffcore.h"
|
||||
|
||||
static int should_break(struct diff_filespec *src,
|
||||
static int should_break(struct repository *r,
|
||||
struct diff_filespec *src,
|
||||
struct diff_filespec *dst,
|
||||
int break_score,
|
||||
int *merge_score_p)
|
||||
@ -61,7 +62,8 @@ static int should_break(struct diff_filespec *src,
|
||||
oideq(&src->oid, &dst->oid))
|
||||
return 0; /* they are the same */
|
||||
|
||||
if (diff_populate_filespec(src, 0) || diff_populate_filespec(dst, 0))
|
||||
if (diff_populate_filespec(r, src, 0) ||
|
||||
diff_populate_filespec(r, dst, 0))
|
||||
return 0; /* error but caught downstream */
|
||||
|
||||
max_size = ((src->size > dst->size) ? src->size : dst->size);
|
||||
@ -71,7 +73,7 @@ static int should_break(struct diff_filespec *src,
|
||||
if (!src->size)
|
||||
return 0; /* we do not let empty files get renamed */
|
||||
|
||||
if (diffcore_count_changes(src, dst,
|
||||
if (diffcore_count_changes(r, src, dst,
|
||||
&src->cnt_data, &dst->cnt_data,
|
||||
&src_copied, &literal_added))
|
||||
return 0;
|
||||
@ -114,7 +116,7 @@ static int should_break(struct diff_filespec *src,
|
||||
return 1;
|
||||
}
|
||||
|
||||
void diffcore_break(int break_score)
|
||||
void diffcore_break(struct repository *r, int break_score)
|
||||
{
|
||||
struct diff_queue_struct *q = &diff_queued_diff;
|
||||
struct diff_queue_struct outq;
|
||||
@ -178,7 +180,7 @@ void diffcore_break(int break_score)
|
||||
object_type(p->one->mode) == OBJ_BLOB &&
|
||||
object_type(p->two->mode) == OBJ_BLOB &&
|
||||
!strcmp(p->one->path, p->two->path)) {
|
||||
if (should_break(p->one, p->two,
|
||||
if (should_break(r, p->one, p->two,
|
||||
break_score, &score)) {
|
||||
/* Split this into delete and create */
|
||||
struct diff_filespec *null_one, *null_two;
|
||||
|
Reference in New Issue
Block a user