Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2020-04-08 01:11:41 +0300
committerJunio C Hamano <gitster@pobox.com>2020-04-08 02:09:29 +0300
commit1c37e86ab2834dfca311799e799568794bc474ce (patch)
tree591e447109aed7b2dc9d6cee2e7826c04de70803 /diffcore-rename.c
parentdb7ed7418b3702ab2b2df755764c3f452917a890 (diff)
diff: make diff_populate_filespec_options struct
The behavior of diff_populate_filespec() currently can be customized through a bitflag, but a subsequent patch requires it to support a non-boolean option. Replace the bitflag with an options struct. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diffcore-rename.c')
-rw-r--r--diffcore-rename.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c
index e189f407af..bf4c0b8740 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -148,6 +148,9 @@ static int estimate_similarity(struct repository *r,
*/
unsigned long max_size, delta_size, base_size, src_copied, literal_added;
int score;
+ struct diff_populate_filespec_options dpf_options = {
+ .check_size_only = 1
+ };
/* We deal only with regular files. Symlink renames are handled
* only when they are exact matches --- in other words, no edits
@@ -166,10 +169,10 @@ static int estimate_similarity(struct repository *r,
* say whether the size is valid or not!)
*/
if (!src->cnt_data &&
- diff_populate_filespec(r, src, CHECK_SIZE_ONLY))
+ diff_populate_filespec(r, src, &dpf_options))
return 0;
if (!dst->cnt_data &&
- diff_populate_filespec(r, dst, CHECK_SIZE_ONLY))
+ diff_populate_filespec(r, dst, &dpf_options))
return 0;
max_size = ((src->size > dst->size) ? src->size : dst->size);
@@ -187,9 +190,9 @@ static int estimate_similarity(struct repository *r,
if (max_size * (MAX_SCORE-minimum_score) < delta_size * MAX_SCORE)
return 0;
- if (!src->cnt_data && diff_populate_filespec(r, src, 0))
+ if (!src->cnt_data && diff_populate_filespec(r, src, NULL))
return 0;
- if (!dst->cnt_data && diff_populate_filespec(r, dst, 0))
+ if (!dst->cnt_data && diff_populate_filespec(r, dst, NULL))
return 0;
if (diffcore_count_changes(r, src, dst,
@@ -261,7 +264,7 @@ static unsigned int hash_filespec(struct repository *r,
struct diff_filespec *filespec)
{
if (!filespec->oid_valid) {
- if (diff_populate_filespec(r, filespec, 0))
+ if (diff_populate_filespec(r, filespec, NULL))
return 0;
hash_object_file(r->hash_algo, filespec->data, filespec->size,
"blob", &filespec->oid);