Rename REFRESH_SAY_CHANGED to REFRESH_IN_PORCELAIN.
[gitweb.git] / builtin-push.c
index bc0c91aa4e4e15a5a88f988d0cea5312bb60e7cd..67f6d96fbeb180b6438172207ff5290c7344cc67 100644 (file)
@@ -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;