]> git.ipfire.org Git - thirdparty/git.git/commitdiff
remote: don't show success message when set-head fails
authorChristian Schlack <christian@backhub.co>
Thu, 17 Sep 2020 15:27:38 +0000 (15:27 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 17 Sep 2020 18:40:17 +0000 (11:40 -0700)
Suppress the message 'origin/HEAD set to master' in case of an error.

  $ git remote set-head origin -a
  error: Not a valid ref: refs/remotes/origin/master
  origin/HEAD set to master

Signed-off-by: Christian Schlack <christian@backhub.co>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/remote.c

index e8377994e57a2286f9cea329578c8f104a392b88..90ab40a152e78de3ce7f47f1d0108a889fa61e18 100644 (file)
@@ -1355,7 +1355,7 @@ static int set_head(int argc, const char **argv)
                        result |= error(_("Not a valid ref: %s"), buf2.buf);
                else if (create_symref(buf.buf, buf2.buf, "remote set-head"))
                        result |= error(_("Could not setup %s"), buf.buf);
-               if (opt_a)
+               else if (opt_a)
                        printf("%s/HEAD set to %s\n", argv[0], head_name);
                free(head_name);
        }