summaryrefslogtreecommitdiff
path: root/builtin/fetch.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2019-11-03 00:21:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-11-06 01:59:36 (GMT)
commitc14e6e790392647ed3b540b0be3d51d1b8a711c4 (patch)
tree68070d7eee7b2afb09c312d11733429e47b61e2f /builtin/fetch.c
parentda72936f544fec5a335e66432610e4cef4430991 (diff)
downloadgit-c14e6e790392647ed3b540b0be3d51d1b8a711c4.zip
git-c14e6e790392647ed3b540b0be3d51d1b8a711c4.tar.gz
git-c14e6e790392647ed3b540b0be3d51d1b8a711c4.tar.bz2
fetch: add the command-line option `--write-commit-graph`
This option overrides the config setting `fetch.writeCommitGraph`, if both are set. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fetch.c')
-rw-r--r--builtin/fetch.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 863c858..8d27f8a 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()
};
@@ -1865,7 +1868,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));