diff options
| author | Junio C Hamano <gitster@pobox.com> | 2022-07-27 13:00:30 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-07-27 13:00:30 -0700 |
| commit | 54ec7b817d15d4e7a24935286a9f8382ce216651 (patch) | |
| tree | 040d2703e11db2437b366fa1c7a0c2231c9dc927 | |
| parent | 162cfddb466111636232b7a6e75f50fe4d57ce8e (diff) | |
| parent | 817b0f60271086fb53fca2e56d426507b82c7dbd (diff) | |
| download | git-54ec7b817d15d4e7a24935286a9f8382ce216651.tar.xz | |
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: <748f39a9-65aa-2110-cf92-7ddf81b5f507@roku.com>
* ro/mktree-allow-missing-fix:
mktree: do not check type of remote objects
| -rw-r--r-- | builtin/mktree.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/builtin/mktree.c b/builtin/mktree.c index 902edba6d2..06d81400f5 100644 --- a/builtin/mktree.c +++ b/builtin/mktree.c @@ -74,6 +74,7 @@ static void mktree_line(char *buf, int nul_term_line, int allow_missing) unsigned mode; enum object_type mode_type; /* object type derived from mode */ enum object_type obj_type; /* object type derived from sha */ + struct object_info oi = OBJECT_INFO_INIT; char *path, *to_free = NULL; struct object_id oid; @@ -116,8 +117,14 @@ static void mktree_line(char *buf, int nul_term_line, int allow_missing) path, ptr, type_name(mode_type)); } - /* Check the type of object identified by sha1 */ - obj_type = oid_object_info(the_repository, &oid, NULL); + /* Check the type of object identified by oid without fetching objects */ + oi.typep = &obj_type; + if (oid_object_info_extended(the_repository, &oid, &oi, + OBJECT_INFO_LOOKUP_REPLACE | + OBJECT_INFO_QUICK | + OBJECT_INFO_SKIP_FETCH_OBJECT) < 0) + obj_type = -1; + if (obj_type < 0) { if (allow_missing) { ; /* no problem - missing objects are presumed to be of the right type */ |
