From: Derrick Stolee <derrickstolee@xxxxxxxxxx> If a user cloned using a bundle URI, then they might want to re-use it to download new bundles during 'git fetch' before fetching the remaining objects from the origin server. Use the 'fetch.bundleURI' config as the indicator for whether this extra step should happen. Do not fetch bundles if --dry-run is specified. RFC-TODO: add tests. RFC-TODO: update Documentation/git-fetch.txt RFC-TODO: update Documentation/config/ Signed-off-by: Derrick Stolee <derrickstolee@xxxxxxxxxx> --- builtin/fetch.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/builtin/fetch.c b/builtin/fetch.c index 6f5e1578639..c0fece55632 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -29,6 +29,7 @@ #include "commit-graph.h" #include "shallow.h" #include "worktree.h" +#include "bundle.h" #define FORCED_UPDATES_DELAY_WARNING_IN_MS (10 * 1000) @@ -2081,6 +2082,22 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) /* FETCH_HEAD never gets updated in --dry-run mode */ if (dry_run) write_fetch_head = 0; + else { + /* + * --dry-run mode skips bundle downloads, which might + * update some refs. + */ + char *bundle_uri = NULL; + git_config_get_string("fetch.bundleuri", &bundle_uri); + + if (bundle_uri) { + char *filter = NULL; + git_config_get_string("fetch.bundlefilter", &filter); + fetch_bundle_uri(bundle_uri, filter); + free(bundle_uri); + free(filter); + } + } if (all) { if (argc == 1) -- gitgitgadget