Merge branch 'ak/protect-any-current-branch'
[git/debian.git] / rebase.c
blob6775cddb28434d0780cb483357476f4783e1f596
1 #include "rebase.h"
2 #include "config.h"
3 #include "gettext.h"
5 /*
6 * Parses textual value for pull.rebase, branch.<name>.rebase, etc.
7 * Unrecognised value yields REBASE_INVALID, which traditionally is
8 * treated the same way as REBASE_FALSE.
10 * The callers that care if (any) rebase is requested should say
11 * if (REBASE_TRUE <= rebase_parse_value(string))
13 * The callers that want to differenciate an unrecognised value and
14 * false can do so by treating _INVALID and _FALSE differently.
16 enum rebase_type rebase_parse_value(const char *value)
18 int v = git_parse_maybe_bool(value);
20 if (!v)
21 return REBASE_FALSE;
22 else if (v > 0)
23 return REBASE_TRUE;
24 else if (!strcmp(value, "merges") || !strcmp(value, "m"))
25 return REBASE_MERGES;
26 else if (!strcmp(value, "interactive") || !strcmp(value, "i"))
27 return REBASE_INTERACTIVE;
28 else if (!strcmp(value, "preserve") || !strcmp(value, "p"))
29 error(_("%s: 'preserve' superseded by 'merges'"), value);
31 * Please update _git_config() in git-completion.bash when you
32 * add new rebase modes.
35 return REBASE_INVALID;