diff options
Diffstat (limited to 'parse-options-cb.c')
-rw-r--r-- | parse-options-cb.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/parse-options-cb.c b/parse-options-cb.c index 3c811e1e4a..d346dbe210 100644 --- a/parse-options-cb.c +++ b/parse-options-cb.c @@ -1,5 +1,6 @@ #include "git-compat-util.h" #include "parse-options.h" +#include "branch.h" #include "cache.h" #include "commit.h" #include "color.h" @@ -293,3 +294,18 @@ int parse_opt_passthru_argv(const struct option *opt, const char *arg, int unset return 0; } + +int parse_opt_tracking_mode(const struct option *opt, const char *arg, int unset) +{ + if (unset) + *(enum branch_track *)opt->value = BRANCH_TRACK_NEVER; + else if (!arg || !strcmp(arg, "direct")) + *(enum branch_track *)opt->value = BRANCH_TRACK_EXPLICIT; + else if (!strcmp(arg, "inherit")) + *(enum branch_track *)opt->value = BRANCH_TRACK_INHERIT; + else + return error(_("option `%s' expects \"%s\" or \"%s\""), + "--track", "direct", "inherit"); + + return 0; +} |