diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-03-26 08:26:25 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-03-26 08:26:25 +0100 |
commit | 2545c089e329d340a9bdec9f725fa737063dd7f6 (patch) | |
tree | 04c86073e04ff56e3037e46aeef947c51d7d608a /config.c | |
parent | Merge branch 'dm/maint-docco' (diff) | |
parent | builtin-push.c: Fix typo: "anythig" -> "anything" (diff) | |
download | git-2545c089e329d340a9bdec9f725fa737063dd7f6.tar.xz git-2545c089e329d340a9bdec9f725fa737063dd7f6.zip |
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); |