diff options
| author | Jonathan Tan <jonathantanmy@google.com> | 2020-08-05 16:06:49 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2020-08-06 13:01:02 -0700 |
| commit | 1d8d9cb62099e1524ce1269ea88faad871c2197f (patch) | |
| tree | d319dd7f637a3c89fa0a6ed3ff0f37c758643a05 /diff.c | |
| parent | Fourth batch (diff) | |
| download | git-1d8d9cb62099e1524ce1269ea88faad871c2197f.tar.gz git-1d8d9cb62099e1524ce1269ea88faad871c2197f.zip | |
sha1-file: introduce no-lazy-fetch has_object()
There have been a few bugs wherein Git fetches missing objects whenever
the existence of an object is checked, even though it does not need to
perform such a fetch. To resolve these bugs, we could look at all the
places that has_object_file() (or a similar function) is used. As a
first step, introduce a new function has_object() that checks for the
existence of an object, with a default behavior of not fetching if the
object is missing and the repository is a partial clone. As we verify
each has_object_file() (or similar) usage, we can replace it with
has_object(), and we will know that we are done when we can delete
has_object_file() (and the other similar functions).
Also, the new function has_object() has more appropriate defaults:
besides not fetching, it also does not recheck packed storage.
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
0 files changed, 0 insertions, 0 deletions
