Skip to content

Commit b044db9

Browse files
committed
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 <[email protected]>
1 parent 278f4be commit b044db9

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

builtin/pull.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#include "commit-reach.h"
2828
#include "sequencer.h"
2929

30-
static int default_mode;
31-
3230
/**
3331
* Parses the value of --rebase. If value is a false value, returns
3432
* 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)
326324
* looks for the value of "pull.rebase". If both configuration keys do not
327325
* exist, returns REBASE_FALSE.
328326
*/
329-
static enum rebase_type config_get_rebase(void)
327+
static enum rebase_type config_get_rebase(int *rebase_unspecified)
330328
{
331329
struct branch *curr_branch = branch_get("HEAD");
332330
const char *value;
@@ -346,7 +344,7 @@ static enum rebase_type config_get_rebase(void)
346344
if (!git_config_get_value("pull.rebase", &value))
347345
return parse_config_rebase("pull.rebase", value, 1);
348346

349-
default_mode = 1;
347+
*rebase_unspecified = 1;
350348

351349
return REBASE_FALSE;
352350
}
@@ -934,6 +932,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
934932
struct object_id orig_head, curr_head;
935933
struct object_id rebase_fork_point;
936934
int autostash;
935+
int rebase_unspecified = 0;
937936

938937
if (!getenv("GIT_REFLOG_ACTION"))
939938
set_reflog_message(argc, argv);
@@ -955,7 +954,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
955954
opt_ff = xstrdup_or_null(config_get_ff());
956955

957956
if (opt_rebase < 0)
958-
opt_rebase = config_get_rebase();
957+
opt_rebase = config_get_rebase(&rebase_unspecified);
959958

960959
if (read_cache_unmerged())
961960
die_resolve_conflict("pull");
@@ -1029,7 +1028,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
10291028
if (opt_rebase && merge_heads.nr > 1)
10301029
die(_("Cannot rebase onto multiple branches."));
10311030

1032-
if (default_mode && opt_verbosity >= 0 && !opt_ff) {
1031+
if (rebase_unspecified && opt_verbosity >= 0 && !opt_ff) {
10331032
advise(_("Pulling without specifying how to reconcile divergent branches is\n"
10341033
"discouraged. You can squelch this message by running one of the following\n"
10351034
"commands sometime before your next pull:\n"

0 commit comments

Comments
 (0)