pull: get rid of unnecessary global variable

It is easy enough to do, and gives a more descriptive name to the variable that is scoped in a more focused way. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Dec 14, 2020 at 09:05 UTC b044db9172f020768e85835f87bfc5564e310714
1 file changed +5 -6
builtin/pull.c
+5 -6
@@ -27,8 +27,6 @@
27 #include "commit-reach.h"
28 #include "sequencer.h"
29
30 -static int default_mode;
31 -
30 /**
31 * Parses the value of --rebase. If value is a false value, returns
32 * REBASE_FALSE. If value is a true value, returns REBASE_TRUE. If value is
@@ -326,7 +324,7 @@ static const char *config_get_ff(void)
324 * looks for the value of "pull.rebase". If both configuration keys do not
325 * exist, returns REBASE_FALSE.
326 */
329 -static enum rebase_type config_get_rebase(void)
327 +static enum rebase_type config_get_rebase(int *rebase_unspecified)
328 {
329 struct branch *curr_branch = branch_get("HEAD");
330 const char *value;
@@ -346,7 +344,7 @@ static enum rebase_type config_get_rebase(void)
344 if (!git_config_get_value("pull.rebase", &value))
345 return parse_config_rebase("pull.rebase", value, 1);
346
349 - default_mode = 1;
347 + *rebase_unspecified = 1;
348
349 return REBASE_FALSE;
350 }
@@ -934,6 +932,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
932 struct object_id orig_head, curr_head;
933 struct object_id rebase_fork_point;
934 int autostash;
935 + int rebase_unspecified = 0;
936
937 if (!getenv("GIT_REFLOG_ACTION"))
938 set_reflog_message(argc, argv);
@@ -955,7 +954,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
954 opt_ff = xstrdup_or_null(config_get_ff());
955
956 if (opt_rebase < 0)
958 - opt_rebase = config_get_rebase();
957 + opt_rebase = config_get_rebase(&rebase_unspecified);
958
959 if (read_cache_unmerged())
960 die_resolve_conflict("pull");
@@ -1029,7 +1028,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
1028 if (opt_rebase && merge_heads.nr > 1)
1029 die(_("Cannot rebase onto multiple branches."));
1030
1032 - if (default_mode && opt_verbosity >= 0 && !opt_ff) {
1031 + if (rebase_unspecified && opt_verbosity >= 0 && !opt_ff) {
1032 advise(_("Pulling without specifying how to reconcile divergent branches is\n"
1033 "discouraged. You can squelch this message by running one of the following\n"
1034 "commands sometime before your next pull:\n"