diff options
Diffstat (limited to 'builtin/fetch.c')
-rw-r--r-- | builtin/fetch.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c index 0c345b5dfe..f8765b385b 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -77,6 +77,7 @@ static struct refspec refmap = REFSPEC_INIT_FETCH; static struct list_objects_filter_options filter_options; static struct string_list server_options = STRING_LIST_INIT_DUP; static struct string_list negotiation_tip = STRING_LIST_INIT_NODUP; +static int fetch_write_commit_graph = -1; static int git_fetch_config(const char *k, const char *v, void *cb) { @@ -198,6 +199,8 @@ static struct option builtin_fetch_options[] = { N_("run 'gc --auto' after fetching")), OPT_BOOL(0, "show-forced-updates", &fetch_show_forced_updates, N_("check for forced-updates on all updated branches")), + OPT_BOOL(0, "write-commit-graph", &fetch_write_commit_graph, + N_("write the commit-graph after fetching")), OPT_END() }; @@ -954,18 +957,12 @@ static int store_updated_refs(const char *raw_url, const char *remote_name, kind = ""; what = ""; } - else if (starts_with(rm->name, "refs/heads/")) { + else if (skip_prefix(rm->name, "refs/heads/", &what)) kind = "branch"; - what = rm->name + 11; - } - else if (starts_with(rm->name, "refs/tags/")) { + else if (skip_prefix(rm->name, "refs/tags/", &what)) kind = "tag"; - what = rm->name + 10; - } - else if (starts_with(rm->name, "refs/remotes/")) { + else if (skip_prefix(rm->name, "refs/remotes/", &what)) kind = "remote-tracking branch"; - what = rm->name + 13; - } else { kind = ""; what = rm->name; @@ -1074,7 +1071,8 @@ static int check_exist_and_connected(struct ref *ref_map) * we need all direct targets to exist. */ for (r = rm; r; r = r->next) { - if (!has_object_file(&r->old_oid)) + if (!has_object_file_with_flags(&r->old_oid, + OBJECT_INFO_SKIP_FETCH_OBJECT)) return -1; } @@ -1400,7 +1398,7 @@ static int do_fetch(struct transport *transport, /* * We're setting the upstream configuration for the - * current branch. The relevent upstream is the + * current branch. The relevant upstream is the * fetched branch that is meant to be merged with the * current one, i.e. the one fetched to FETCH_HEAD. * @@ -1411,7 +1409,7 @@ static int do_fetch(struct transport *transport, for (rm = ref_map; rm; rm = rm->next) { if (!rm->peer_ref) { if (source_ref) { - warning(_("multiple branch detected, incompatible with --set-upstream")); + warning(_("multiple branches detected, incompatible with --set-upstream")); goto skip; } else { source_ref = rm; @@ -1599,7 +1597,8 @@ static int fetch_multiple(struct string_list *list, int max_children) return errcode; } - argv_array_pushl(&argv, "fetch", "--append", "--no-auto-gc", NULL); + argv_array_pushl(&argv, "fetch", "--append", "--no-auto-gc", + "--no-write-commit-graph", NULL); add_options_to_argv(&argv); if (max_children != 1 && list->nr != 1) { @@ -1755,8 +1754,6 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) packet_trace_identity("fetch"); - fetch_if_missing = 0; - /* Record the command line for the reflog */ strbuf_addstr(&default_rla, "fetch"); for (i = 1; i < argc; i++) @@ -1865,7 +1862,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) string_list_clear(&list, 0); prepare_repo_settings(the_repository); - if (the_repository->settings.fetch_write_commit_graph) { + if (fetch_write_commit_graph > 0 || + (fetch_write_commit_graph < 0 && + the_repository->settings.fetch_write_commit_graph)) { int commit_graph_flags = COMMIT_GRAPH_WRITE_SPLIT; struct split_commit_graph_opts split_opts; memset(&split_opts, 0, sizeof(struct split_commit_graph_opts)); |