1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-08 21:26:08 +02:00

Merge branch 'jt/pretend-object-never-come-from-elsewhere'

The pretend-object mechanism checks if the given object already
exists in the object store before deciding to keep the data
in-core, but the check would have triggered lazy fetching of such
an object from a promissor remote.

* jt/pretend-object-never-come-from-elsewhere:
  sha1-file: make pretend_object_file() not prefetch
This commit is contained in:
Junio C Hamano 2020-08-04 13:53:58 -07:00
commit 5b137e8441
2 changed files with 13 additions and 1 deletions

View File

@ -1600,7 +1600,8 @@ int pretend_object_file(void *buf, unsigned long len, enum object_type type,
struct cached_object *co;
hash_object_file(the_hash_algo, buf, len, type_name(type), oid);
if (has_object_file(oid) || find_cached_object(oid))
if (has_object_file_with_flags(oid, OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT) ||
find_cached_object(oid))
return 0;
ALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc);
co = &cached_objects[cached_object_nr++];

View File

@ -122,4 +122,15 @@ test_expect_success '--exclude-promisor-objects does not BUG-crash' '
test_must_fail git blame --exclude-promisor-objects one
'
test_expect_success 'blame with uncommitted edits in partial clone does not crash' '
git init server &&
echo foo >server/file.txt &&
git -C server add file.txt &&
git -C server commit -m file &&
git clone --filter=blob:none "file://$(pwd)/server" client &&
echo bar >>client/file.txt &&
git -C client blame file.txt
'
test_done