Merge branch 'bc/wildcard-credential'
[alt-git.git] / rebase.c
blobf8137d859b51114b75995f1c5c8f6cd282b1f3c4
1 #include "rebase.h"
2 #include "config.h"
4 /*
5 * Parses textual value for pull.rebase, branch.<name>.rebase, etc.
6 * Unrecognised value yields REBASE_INVALID, which traditionally is
7 * treated the same way as REBASE_FALSE.
9 * The callers that care if (any) rebase is requested should say
10 * if (REBASE_TRUE <= rebase_parse_value(string))
12 * The callers that want to differenciate an unrecognised value and
13 * false can do so by treating _INVALID and _FALSE differently.
15 enum rebase_type rebase_parse_value(const char *value)
17 int v = git_parse_maybe_bool(value);
19 if (!v)
20 return REBASE_FALSE;
21 else if (v > 0)
22 return REBASE_TRUE;
23 else if (!strcmp(value, "preserve") || !strcmp(value, "p"))
24 return REBASE_PRESERVE;
25 else if (!strcmp(value, "merges") || !strcmp(value, "m"))
26 return REBASE_MERGES;
27 else if (!strcmp(value, "interactive") || !strcmp(value, "i"))
28 return REBASE_INTERACTIVE;
30 * Please update _git_config() in git-completion.bash when you
31 * add new rebase modes.
34 return REBASE_INVALID;