]> git.ipfire.org Git - thirdparty/git.git/blame - rebase.c
reftable: rename writer_stats to reftable_writer_stats
[thirdparty/git.git] / rebase.c
CommitLineData
88f8576e
BW
1#include "rebase.h"
2#include "config.h"
52f1e821 3#include "gettext.h"
88f8576e
BW
4
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.
9 *
10 * The callers that care if (any) rebase is requested should say
11 * if (REBASE_TRUE <= rebase_parse_value(string))
12 *
13 * The callers that want to differenciate an unrecognised value and
14 * false can do so by treating _INVALID and _FALSE differently.
15 */
16enum rebase_type rebase_parse_value(const char *value)
17{
18 int v = git_parse_maybe_bool(value);
19
20 if (!v)
21 return REBASE_FALSE;
22 else if (v > 0)
23 return REBASE_TRUE;
88f8576e
BW
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;
52f1e821
JS
28 else if (!strcmp(value, "preserve") || !strcmp(value, "p"))
29 error(_("%s: 'preserve' superseded by 'merges'"), value);
88f8576e
BW
30 /*
31 * Please update _git_config() in git-completion.bash when you
32 * add new rebase modes.
33 */
34
35 return REBASE_INVALID;
36}