summaryrefslogtreecommitdiff
path: root/builtin/pull.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-12-14 17:05:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-12-16 01:39:17 (GMT)
commitb044db9172f020768e85835f87bfc5564e310714 (patch)
treee01bd29b656ceaa88ecf56d264548db8c7de3ecb /builtin/pull.c
parent278f4be806f93579c64cd9993fdad2eb589f86c6 (diff)
downloadgit-b044db9172f020768e85835f87bfc5564e310714.zip
git-b044db9172f020768e85835f87bfc5564e310714.tar.gz
git-b044db9172f020768e85835f87bfc5564e310714.tar.bz2
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>
Diffstat (limited to 'builtin/pull.c')
-rw-r--r--builtin/pull.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/builtin/pull.c b/builtin/pull.c
index ff8e3ce..2976b8e 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -27,8 +27,6 @@
#include "commit-reach.h"
#include "sequencer.h"
-static int default_mode;
-
/**
* Parses the value of --rebase. If value is a false value, returns
* 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)
* looks for the value of "pull.rebase". If both configuration keys do not
* exist, returns REBASE_FALSE.
*/
-static enum rebase_type config_get_rebase(void)
+static enum rebase_type config_get_rebase(int *rebase_unspecified)
{
struct branch *curr_branch = branch_get("HEAD");
const char *value;
@@ -346,7 +344,7 @@ static enum rebase_type config_get_rebase(void)
if (!git_config_get_value("pull.rebase", &value))
return parse_config_rebase("pull.rebase", value, 1);
- default_mode = 1;
+ *rebase_unspecified = 1;
return REBASE_FALSE;
}
@@ -934,6 +932,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
struct object_id orig_head, curr_head;
struct object_id rebase_fork_point;
int autostash;
+ int rebase_unspecified = 0;
if (!getenv("GIT_REFLOG_ACTION"))
set_reflog_message(argc, argv);
@@ -955,7 +954,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
opt_ff = xstrdup_or_null(config_get_ff());
if (opt_rebase < 0)
- opt_rebase = config_get_rebase();
+ opt_rebase = config_get_rebase(&rebase_unspecified);
if (read_cache_unmerged())
die_resolve_conflict("pull");
@@ -1029,7 +1028,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
if (opt_rebase && merge_heads.nr > 1)
die(_("Cannot rebase onto multiple branches."));
- if (default_mode && opt_verbosity >= 0 && !opt_ff) {
+ if (rebase_unspecified && opt_verbosity >= 0 && !opt_ff) {
advise(_("Pulling without specifying how to reconcile divergent branches is\n"
"discouraged. You can squelch this message by running one of the following\n"
"commands sometime before your next pull:\n"