git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* [PATCH] remote: in case of error don't show success message.
@ 2020-09-17 15:27 Christian Schlack via GitGitGadget
  2020-09-17 18:39 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Schlack via GitGitGadget @ 2020-09-17 15:27 UTC (permalink / raw)
  To: git; +Cc: Christian Schlack, Christian Schlack

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] remote: in case of error don't show success message.
  2020-09-17 15:27 [PATCH] remote: in case of error don't show success message Christian Schlack via GitGitGadget
@ 2020-09-17 18:39 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2020-09-17 18:39 UTC (permalink / raw)
  To: Christian Schlack via GitGitGadget; +Cc: git, Christian Schlack

"Christian Schlack via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> 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);
>  	}
>

Quite straight-forward and looks obviously good.

Thanks, will queue.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-17 18:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 15:27 [PATCH] remote: in case of error don't show success message Christian Schlack via GitGitGadget
2020-09-17 18:39 ` Junio C Hamano

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git