diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-10-19 07:34:04 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-10-19 07:34:04 +0300 |
commit | a1e9dff182b19a2620aab036c22389d22b9dd0be (patch) | |
tree | adafb6980bea622e5447f219964e689e679032da /builtin | |
parent | 4d87b38e6c1a73dbe744a30b9b3cdf88e69de7b4 (diff) | |
parent | 35f9e3e5e7a6436b50a8709e7e14a65a10cc1e7a (diff) |
Merge branch 'jt/fetch-tips-in-partial-clone'
"git fetch $repo $object" in a partial clone did not correctly
fetch the asked-for object that is referenced by an object in
promisor packfile, which has been fixed.
* jt/fetch-tips-in-partial-clone:
fetch: in partial clone, check presence of targets
connected: document connectivity in partial clones
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/fetch.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c index 0696abfc2a..6ce882ce82 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -931,10 +931,11 @@ static int store_updated_refs(const char *raw_url, const char *remote_name, * everything we are going to fetch already exists and is connected * locally. */ -static int quickfetch(struct ref *ref_map) +static int check_exist_and_connected(struct ref *ref_map) { struct ref *rm = ref_map; struct check_connected_options opt = CHECK_CONNECTED_INIT; + struct ref *r; /* * If we are deepening a shallow clone we already have these @@ -945,13 +946,23 @@ static int quickfetch(struct ref *ref_map) */ if (deepen) return -1; + + /* + * check_connected() allows objects to merely be promised, but + * we need all direct targets to exist. + */ + for (r = rm; r; r = r->next) { + if (!has_object_file(&r->old_oid)) + return -1; + } + opt.quiet = 1; return check_connected(iterate_ref_map, &rm, &opt); } static int fetch_refs(struct transport *transport, struct ref *ref_map) { - int ret = quickfetch(ref_map); + int ret = check_exist_and_connected(ref_map); if (ret) ret = transport_fetch_refs(transport, ref_map); if (!ret) |