diff options
| author | Junio C Hamano <gitster@pobox.com> | 2022-01-10 11:52:54 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-01-10 11:52:54 -0800 |
| commit | 0669bdf4ebc095a2b26654292e1ff38245ccf88a (patch) | |
| tree | e1cbee05b782fabade7aefc3767ffdbf28f75dfd /parse-options-cb.c | |
| parent | 4b51386bbfc5d26e552c3c4be135e31cd2f64b44 (diff) | |
| parent | 44f14a9d24cd9f04a0a789e58968d52d44d7f332 (diff) | |
| download | git-0669bdf4ebc095a2b26654292e1ff38245ccf88a.tar.xz | |
Merge branch 'js/branch-track-inherit'
"git -c branch.autosetupmerge=inherit branch new old" makes "new"
to have the same upstream as the "old" branch, instead of marking
"old" itself as its upstream.
* js/branch-track-inherit:
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.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; +} |
