diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-08-12 16:36:04 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-08-12 16:36:04 -0700 |
commit | 6ffd781226f04629eff63a684b47ad7555143312 (patch) | |
tree | e41ea02c886afd117f51b257d57f84043e447efd /builtin-push.c | |
parent | 19a7fcbf16276321f83e0c1748b3935a2ea42675 (diff) | |
parent | 2cd9c2aff0d65bbce704a68d9cbe7a17e02257fe (diff) | |
download | git-6ffd781226f04629eff63a684b47ad7555143312.tar.gz |
Merge branch 'maint'
* maint:
push: point to 'git pull' and 'git push --force' in case of non-fast forward
Documentation: add: <filepattern>... is optional
Change mentions of "git programs" to "git commands"
Documentation: merge: one <remote> is required
help.c: give correct structure's size to memset()
Diffstat (limited to 'builtin-push.c')
-rw-r--r-- | builtin-push.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/builtin-push.c b/builtin-push.c index bc0c91aa4e..67f6d96fbe 100644 --- a/builtin-push.c +++ b/builtin-push.c @@ -140,6 +140,7 @@ static int do_push(const char *repo, int flags) struct transport *transport = transport_get(remote, url[i]); int err; + int nonfastforward; if (receivepack) transport_set_option(transport, TRANS_OPT_RECEIVEPACK, receivepack); @@ -148,13 +149,19 @@ static int do_push(const char *repo, int flags) if (flags & TRANSPORT_PUSH_VERBOSE) fprintf(stderr, "Pushing to %s\n", url[i]); - err = transport_push(transport, refspec_nr, refspec, flags); + err = transport_push(transport, refspec_nr, refspec, flags, + &nonfastforward); err |= transport_disconnect(transport); if (!err) continue; error("failed to push some refs to '%s'", url[i]); + if (nonfastforward) { + printf("To prevent you from losing history, non-fast-forward updates were rejected.\n" + "Merge the remote changes before pushing again.\n" + "See 'non-fast forward' section of 'git push --help' for details.\n"); + } errs++; } return !!errs; |