diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-03-26 10:26:25 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-03-26 10:26:25 +0300 |
commit | 2545c089e329d340a9bdec9f725fa737063dd7f6 (patch) | |
tree | 04c86073e04ff56e3037e46aeef947c51d7d608a /config.c | |
parent | 0b3035fe15bfd1d1f7cfab71819cb2cf4fc40d61 (diff) | |
parent | b2655cdae953d619d488b69b7d49e4204e5682dc (diff) |
Merge branch 'fg/push-default'
* fg/push-default:
builtin-push.c: Fix typo: "anythig" -> "anything"
Display warning for default git push with no push.default config
New config push.default to decide default behavior for push
Conflicts:
Documentation/config.txt
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -565,6 +565,31 @@ static int git_default_branch_config(const char *var, const char *value) return 0; } +static int git_default_push_config(const char *var, const char *value) +{ + if (!strcmp(var, "push.default")) { + if (!value) + return config_error_nonbool(var); + else if (!strcmp(value, "nothing")) + push_default = PUSH_DEFAULT_NOTHING; + else if (!strcmp(value, "matching")) + push_default = PUSH_DEFAULT_MATCHING; + else if (!strcmp(value, "tracking")) + push_default = PUSH_DEFAULT_TRACKING; + else if (!strcmp(value, "current")) + push_default = PUSH_DEFAULT_CURRENT; + else { + error("Malformed value for %s: %s", var, value); + return error("Must be one of nothing, matching, " + "tracking or current."); + } + return 0; + } + + /* Add other config variables here and to Documentation/config.txt. */ + return 0; +} + static int git_default_mailmap_config(const char *var, const char *value) { if (!strcmp(var, "mailmap.file")) @@ -588,6 +613,9 @@ int git_default_config(const char *var, const char *value, void *dummy) if (!prefixcmp(var, "branch.")) return git_default_branch_config(var, value); + if (!prefixcmp(var, "push.")) + return git_default_push_config(var, value); + if (!prefixcmp(var, "mailmap.")) return git_default_mailmap_config(var, value); |