diff options
| author | Junio C Hamano <gitster@pobox.com> | 2020-04-28 15:50:04 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2020-04-28 15:50:04 -0700 |
| commit | 8f5dc5a4af3fa32bf9261b76b0f1146fd15b8643 (patch) | |
| tree | 0c93139e94d1964edec168d2cf02f6c0e1298b6d /diffcore.h | |
| parent | Merge branch 'js/subtree-doc-update-to-asciidoctor-2' (diff) | |
| parent | diff: restrict when prefetching occurs (diff) | |
| download | git-8f5dc5a4af3fa32bf9261b76b0f1146fd15b8643.tar.gz git-8f5dc5a4af3fa32bf9261b76b0f1146fd15b8643.zip | |
Merge branch 'jt/avoid-prefetch-when-able-in-diff'
"git diff" in a partial clone learned to avoid lazy loading blob
objects in more casese when they are not needed.
* jt/avoid-prefetch-when-able-in-diff:
diff: restrict when prefetching occurs
diff: refactor object read
diff: make diff_populate_filespec_options struct
promisor-remote: accept 0 as oid_nr in function
Diffstat (limited to 'diffcore.h')
| -rw-r--r-- | diffcore.h | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/diffcore.h b/diffcore.h index 7c07347e42..d2a63c5c71 100644 --- a/diffcore.h +++ b/diffcore.h @@ -65,9 +65,25 @@ void free_filespec(struct diff_filespec *); void fill_filespec(struct diff_filespec *, const struct object_id *, int, unsigned short); -#define CHECK_SIZE_ONLY 1 -#define CHECK_BINARY 2 -int diff_populate_filespec(struct repository *, struct diff_filespec *, unsigned int); +/* + * Prefetch the entries in diff_queued_diff. The parameter is a pointer to a + * struct repository. + */ +void diff_queued_diff_prefetch(void *repository); + +struct diff_populate_filespec_options { + unsigned check_size_only : 1; + unsigned check_binary : 1; + + /* + * If an object is missing, diff_populate_filespec() will invoke this + * callback before attempting to read that object again. + */ + void (*missing_object_cb)(void *); + void *missing_object_data; +}; +int diff_populate_filespec(struct repository *, struct diff_filespec *, + const struct diff_populate_filespec_options *); void diff_free_filespec_data(struct diff_filespec *); void diff_free_filespec_blob(struct diff_filespec *); int diff_filespec_is_binary(struct repository *, struct diff_filespec *); @@ -182,4 +198,12 @@ int diffcore_count_changes(struct repository *r, unsigned long *src_copied, unsigned long *literal_added); +/* + * If filespec contains an OID and if that object is missing from the given + * repository, add that OID to to_fetch. + */ +void diff_add_if_missing(struct repository *r, + struct oid_array *to_fetch, + const struct diff_filespec *filespec); + #endif |
