Skip to content

Commit 54ec7b8

Browse files
committed
Merge branch 'ro/mktree-allow-missing-fix' into maint
"git mktree --missing" lazily fetched objects that are missing from the local object store, which was totally unnecessary for the purpose of creating the tree object(s) from its input. source: <[email protected]> * ro/mktree-allow-missing-fix: mktree: do not check type of remote objects
2 parents 162cfdd + 817b0f6 commit 54ec7b8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

builtin/mktree.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ static void mktree_line(char *buf, int nul_term_line, int allow_missing)
7474
unsigned mode;
7575
enum object_type mode_type; /* object type derived from mode */
7676
enum object_type obj_type; /* object type derived from sha */
77+
struct object_info oi = OBJECT_INFO_INIT;
7778
char *path, *to_free = NULL;
7879
struct object_id oid;
7980

@@ -116,8 +117,14 @@ static void mktree_line(char *buf, int nul_term_line, int allow_missing)
116117
path, ptr, type_name(mode_type));
117118
}
118119

119-
/* Check the type of object identified by sha1 */
120-
obj_type = oid_object_info(the_repository, &oid, NULL);
120+
/* Check the type of object identified by oid without fetching objects */
121+
oi.typep = &obj_type;
122+
if (oid_object_info_extended(the_repository, &oid, &oi,
123+
OBJECT_INFO_LOOKUP_REPLACE |
124+
OBJECT_INFO_QUICK |
125+
OBJECT_INFO_SKIP_FETCH_OBJECT) < 0)
126+
obj_type = -1;
127+
121128
if (obj_type < 0) {
122129
if (allow_missing) {
123130
; /* no problem - missing objects are presumed to be of the right type */

0 commit comments

Comments
 (0)