summaryrefslogtreecommitdiff
path: root/parse-options-cb.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2022-01-31 10:37:44 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-01-31 10:37:44 -0800
commit09e0be130d83ceedb3653d9a41768c6a13457ac5 (patch)
tree466600cb071233316506ff31a3e9966679fb2908 /parse-options-cb.c
parentThe first batch to start the current cycle (diff)
parentbranch,checkout: fix --track documentation (diff)
downloadtgif-09e0be130d83ceedb3653d9a41768c6a13457ac5.tar.xz
Merge branch 'js/branch-track-inherit' into gc/branch-recurse-submodules
* js/branch-track-inherit: branch,checkout: fix --track documentation branch,checkout: fix --track usage strings config: require lowercase for branch.*.autosetupmerge branch: add flags and config to inherit tracking branch: accept multiple upstream branches for tracking
Diffstat (limited to 'parse-options-cb.c')
-rw-r--r--parse-options-cb.c16
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;
+}