summaryrefslogtreecommitdiff
path: root/advice.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-12-18 21:38:29 -0800
committerJunio C Hamano <gitster@pobox.com>2011-12-18 21:38:56 -0800
commitd8a3581b55e27c071e22a540620cf8a42291af87 (patch)
tree16c29a066773f5231ddb9dab61a7998ee0a5ac19 /advice.c
parent26e94af0ba2f35438bab4a88caa4a16f5e056bac (diff)
downloadgit-jc/advise-push-default.tar.gz
push: hint to use push.default=upstream when appropriatejc/advise-push-default
If you push into a shared repository that others push to, and you have local branches in your repository that matches the remote side but do not keep them up-to-date, then 'matching refs' is not an appropriate default for you. Detect when push failed due to non-fast-forward _and_ we did matching refs by default (i.e. if the user explicitly said ':' from the command line, or had push.default set to 'matching', then we do not want to advise), and give a hint to tell the user that the user may want to set 'push.default' configuration variable to 'upstream', if the remote repository receives pushes from other places. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'advice.c')
-rw-r--r--advice.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/advice.c b/advice.c
index e02e632df3..9b56709d2c 100644
--- a/advice.c
+++ b/advice.c
@@ -6,6 +6,7 @@ int advice_commit_before_merge = 1;
int advice_resolve_conflict = 1;
int advice_implicit_identity = 1;
int advice_detached_head = 1;
+int advice_push_use_upstream = 1;
static struct {
const char *name;
@@ -17,6 +18,7 @@ static struct {
{ "resolveconflict", &advice_resolve_conflict },
{ "implicitidentity", &advice_implicit_identity },
{ "detachedhead", &advice_detached_head },
+ { "pushuseupstream", &advice_push_use_upstream },
};
void advise(const char *advice, ...)