]> git.ipfire.org Git - thirdparty/git.git/blame - rebase.c
reftable: read reftable files
[thirdparty/git.git] / rebase.c
CommitLineData
88f8576e
BW
1#include "rebase.h"
2#include "config.h"
3
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.
8 *
9 * The callers that care if (any) rebase is requested should say
10 * if (REBASE_TRUE <= rebase_parse_value(string))
11 *
12 * The callers that want to differenciate an unrecognised value and
13 * false can do so by treating _INVALID and _FALSE differently.
14 */
15enum rebase_type rebase_parse_value(const char *value)
16{
17 int v = git_parse_maybe_bool(value);
18
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;
29 /*
30 * Please update _git_config() in git-completion.bash when you
31 * add new rebase modes.
32 */
33
34 return REBASE_INVALID;
35}