]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin-push.c
Fix some printf format warnings
[thirdparty/git.git] / builtin-push.c
index 67f6d96fbeb180b6438172207ff5290c7344cc67..3cb1ee46d1da898c2be5666a93002ca43df80093 100644 (file)
@@ -10,7 +10,7 @@
 #include "parse-options.h"
 
 static const char * const push_usage[] = {
-       "git push [--all | --mirror] [--dry-run] [--porcelain] [--tags] [--receive-pack=<git-receive-pack>] [--repo=<repository>] [-f | --force] [-v] [<repository> <refspec>...]",
+       "git push [--all | --mirror] [-n | --dry-run] [--porcelain] [--tags] [--receive-pack=<git-receive-pack>] [--repo=<repository>] [-f | --force] [-v] [<repository> <refspec>...]",
        NULL,
 };
 
@@ -157,10 +157,10 @@ static int do_push(const char *repo, int flags)
                        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");
+               if (nonfastforward && advice_push_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++;
        }
@@ -182,7 +182,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
                OPT_BIT( 0 , "mirror", &flags, "mirror all refs",
                            (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE)),
                OPT_BOOLEAN( 0 , "tags", &tags, "push tags"),
-               OPT_BIT( 0 , "dry-run", &flags, "dry run", TRANSPORT_PUSH_DRY_RUN),
+               OPT_BIT('n' , "dry-run", &flags, "dry run", TRANSPORT_PUSH_DRY_RUN),
                OPT_BIT( 0,  "porcelain", &flags, "machine-readable output", TRANSPORT_PUSH_PORCELAIN),
                OPT_BIT('f', "force", &flags, "force updates", TRANSPORT_PUSH_FORCE),
                OPT_BOOLEAN( 0 , "thin", &thin, "use thin pack"),