git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Christian Schlack via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Christian Schlack <christian@backhub.co>,
	Christian Schlack <christian@backhub.co>
Subject: [PATCH] remote: in case of error don't show success message.
Date: Thu, 17 Sep 2020 15:27:38 +0000	[thread overview]
Message-ID: <pull.848.git.git.1600356459092.gitgitgadget@gmail.com> (raw)

From: Christian Schlack <christian@backhub.co>

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>
---
    remote: in case of error don't show success message.
    
    Expected behaviour
    
    $ git remote set-head origin -a
    error: Not a valid ref: refs/remotes/origin/master
    
    Actual behaviour
    
    $ git remote set-head origin -a
    error: Not a valid ref: refs/remotes/origin/master
    origin/HEAD set to master
    
    I believe ... set to master should not be shown in case of an error.
    That's why I added an else to the if-condition.
    
    Signed-off-by: Christian Schlack christian@backhub.co
    [christian@backhub.co]

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-848%2Fcschlack%2Fremote-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-848/cschlack/remote-v1
Pull-Request: https://github.com/git/git/pull/848

 builtin/remote.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/remote.c b/builtin/remote.c
index 542f56e387..64b4b551eb 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -1356,7 +1356,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);
 	}

base-commit: 54e85e7af1ac9e9a92888060d6811ae767fea1bc
-- 
gitgitgadget

             reply	other threads:[~2020-09-17 15:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17 15:27 Christian Schlack via GitGitGadget [this message]
2020-09-17 18:39 ` [PATCH] remote: in case of error don't show success message Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.848.git.git.1600356459092.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=christian@backhub.co \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).