Skip to content

Commit 5b137e8

Browse files
committed
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
2 parents 5c454b3 + a64d2aa commit 5b137e8

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

sha1-file.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,8 @@ int pretend_object_file(void *buf, unsigned long len, enum object_type type,
16001600
struct cached_object *co;
16011601

16021602
hash_object_file(the_hash_algo, buf, len, type_name(type), oid);
1603-
if (has_object_file(oid) || find_cached_object(oid))
1603+
if (has_object_file_with_flags(oid, OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT) ||
1604+
find_cached_object(oid))
16041605
return 0;
16051606
ALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc);
16061607
co = &cached_objects[cached_object_nr++];

t/t8002-blame.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,15 @@ test_expect_success '--exclude-promisor-objects does not BUG-crash' '
122122
test_must_fail git blame --exclude-promisor-objects one
123123
'
124124

125+
test_expect_success 'blame with uncommitted edits in partial clone does not crash' '
126+
git init server &&
127+
echo foo >server/file.txt &&
128+
git -C server add file.txt &&
129+
git -C server commit -m file &&
130+
131+
git clone --filter=blob:none "file://$(pwd)/server" client &&
132+
echo bar >>client/file.txt &&
133+
git -C client blame file.txt
134+
'
135+
125136
test_done

0 commit comments

Comments
 (0)