diff options
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/fetch.c | 12 | ||||
-rw-r--r-- | builtin/receive-pack.c | 7 | ||||
-rw-r--r-- | builtin/rev-list.c | 20 |
3 files changed, 28 insertions, 11 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c index 8ec4eae3eb..77c26caae2 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -368,7 +368,7 @@ static int iterate_ref_map(void *cb_data, unsigned char sha1[20]) } static int store_updated_refs(const char *raw_url, const char *remote_name, - struct ref *ref_map) + struct ref *ref_map, const char *pack_lockfile) { FILE *fp; struct commit *commit; @@ -389,7 +389,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name, url = xstrdup("foreign"); rm = ref_map; - if (check_everything_connected(iterate_ref_map, 0, &rm)) { + if (check_everything_connected(iterate_ref_map, 0, pack_lockfile, &rm)) { rc = error(_("%s did not send all necessary objects\n"), url); goto abort; } @@ -516,7 +516,8 @@ static int quickfetch(struct ref *ref_map) */ if (depth) return -1; - return check_everything_connected(iterate_ref_map, 1, &rm); + return check_everything_connected(iterate_ref_map, + CHECK_CONNECT_QUIET, NULL, &rm); } static int fetch_refs(struct transport *transport, struct ref *ref_map) @@ -526,8 +527,9 @@ static int fetch_refs(struct transport *transport, struct ref *ref_map) ret = transport_fetch_refs(transport, ref_map); if (!ret) ret |= store_updated_refs(transport->url, - transport->remote->name, - ref_map); + transport->remote->name, + ref_map, + transport->pack_lockfile); transport_unlock_pack(transport); return ret; } diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 0afb8b2896..01d37f69cd 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -40,6 +40,7 @@ static int auto_gc = 1; static const char *head_name; static void *head_name_to_free; static int sent_capabilities; +static const char *pack_lockfile; static enum deny_action parse_deny_action(const char *var, const char *value) { @@ -669,7 +670,7 @@ static void set_connectivity_errors(struct command *commands) for (cmd = commands; cmd; cmd = cmd->next) { struct command *singleton = cmd; if (!check_everything_connected(command_singleton_iterator, - 0, &singleton)) + 0, pack_lockfile, &singleton)) continue; cmd->error_string = "missing necessary objects"; } @@ -705,7 +706,7 @@ static void execute_commands(struct command *commands, const char *unpacker_erro cmd = commands; if (check_everything_connected(iterate_receive_command_list, - 0, &cmd)) + 0, pack_lockfile, &cmd)) set_connectivity_errors(commands); if (run_receive_hook(commands, pre_receive_hook, 0)) { @@ -797,8 +798,6 @@ static const char *parse_pack_header(struct pack_header *hdr) } } -static const char *pack_lockfile; - static const char *unpack(void) { struct pack_header hdr; diff --git a/builtin/rev-list.c b/builtin/rev-list.c index 4c4d404afc..21d714b528 100644 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@ -180,8 +180,24 @@ static void finish_object(struct object *obj, struct rev_list_info *info = cb_data; if (obj->type == OBJ_BLOB && !has_sha1_file(obj->sha1)) die("missing blob object '%s'", sha1_to_hex(obj->sha1)); - if (info->revs->verify_objects && !obj->parsed && obj->type != OBJ_COMMIT) - parse_object(obj->sha1); + if (info->revs->verify_objects && + !obj->parsed && obj->type != OBJ_COMMIT) { + const char *safe_pack = info->revs->safe_pack; + struct object_info oi; + int safe = 0; + memset(&oi, 0, sizeof(oi)); + if (*safe_pack && + sha1_object_info_extended(obj->sha1, &oi) >= 0 && + oi.whence == OI_PACKED) { + const char *pack = oi.u.packed.pack->pack_name; + int len = strlen(pack); + assert(strncmp(pack + len - 51, "/pack-", 6) == 0); + assert(strcmp(pack + len - 5, ".pack") == 0); + safe = !memcmp(safe_pack, pack + len - 45, 40); + } + if (!safe) + parse_object(obj->sha1); + } } static void show_object(struct object *obj, |