X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-push.c;h=f8376cffa447a796794983b56e44592be6a87b80;hb=cfe370c6476392095bc3f18013d195b1cccd6184;hp=1d92e22f0aef914217c6a68e2597426bb529e4ba;hpb=a7c1ef3e03985c70aeb0825634471bb6240f4fcb;p=git.git diff --git a/builtin-push.c b/builtin-push.c index 1d92e22f0..f8376cffa 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. See the 'non-fast forward'\n" + "section of 'git push --help' for details.\n"); + } errs++; } return !!errs;