diff --git a/builtin/fetch.c b/builtin/fetch.c index eab73d7417..06e514b07e 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -2133,6 +2133,17 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) strvec_clear(&options); } + /* + * Skip irrelevant tasks because we know objects were not + * fetched. + * + * NEEDSWORK: as a future optimization, we can return early + * whenever objects were not fetched e.g. if we already have all + * of them. + */ + if (negotiate_only) + goto cleanup; + prepare_repo_settings(the_repository); if (fetch_write_commit_graph > 0 || (fetch_write_commit_graph < 0 &&