|
27 | 27 | #include "branch.h" |
28 | 28 | #include "promisor-remote.h" |
29 | 29 | #include "commit-graph.h" |
| 30 | +#include "gvfs.h" |
| 31 | +#include "gvfs-helper-client.h" |
30 | 32 |
|
31 | 33 | #define FORCED_UPDATES_DELAY_WARNING_IN_MS (10 * 1000) |
32 | 34 |
|
@@ -77,6 +79,7 @@ static struct refspec refmap = REFSPEC_INIT_FETCH; |
77 | 79 | static struct list_objects_filter_options filter_options; |
78 | 80 | static struct string_list server_options = STRING_LIST_INIT_DUP; |
79 | 81 | static struct string_list negotiation_tip = STRING_LIST_INIT_NODUP; |
| 82 | +static int update_remote_refs = 1; |
80 | 83 |
|
81 | 84 | static int git_fetch_config(const char *k, const char *v, void *cb) |
82 | 85 | { |
@@ -198,6 +201,8 @@ static struct option builtin_fetch_options[] = { |
198 | 201 | N_("run 'gc --auto' after fetching")), |
199 | 202 | OPT_BOOL(0, "show-forced-updates", &fetch_show_forced_updates, |
200 | 203 | N_("check for forced-updates on all updated branches")), |
| 204 | + OPT_BOOL(0, "update-remote-refs", &update_remote_refs, |
| 205 | + N_("update the refs/remotes/ refspace")), |
201 | 206 | OPT_END() |
202 | 207 | }; |
203 | 208 |
|
@@ -743,6 +748,9 @@ static int update_local_ref(struct ref *ref, |
743 | 748 | const char *pretty_ref = prettify_refname(ref->name); |
744 | 749 | int fast_forward = 0; |
745 | 750 |
|
| 751 | + if (!update_remote_refs && starts_with(ref->name, "refs/remotes/")) |
| 752 | + return 0; |
| 753 | + |
746 | 754 | type = oid_object_info(the_repository, &ref->new_oid, NULL); |
747 | 755 | if (type < 0) |
748 | 756 | die(_("object %s not found"), oid_to_hex(&ref->new_oid)); |
@@ -1824,6 +1832,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) |
1824 | 1832 |
|
1825 | 1833 | fetch_if_missing = 0; |
1826 | 1834 |
|
| 1835 | + if (core_gvfs & GVFS_PREFETCH_DURING_FETCH) |
| 1836 | + gh_client__prefetch(0, NULL); |
| 1837 | + |
1827 | 1838 | if (remote) { |
1828 | 1839 | if (filter_options.choice || has_promisor_remote()) |
1829 | 1840 | fetch_one_setup_partial(remote); |
|
0 commit comments