git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Josh Hunt via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Josh Hunt <joshua.hunt@berkeley.edu>,
	Josh Hunt <johunt@akamai.com>
Subject: Re: [PATCH] branch: return error when --list finds no matches
Date: Wed, 03 Mar 2021 17:27:38 -0800	[thread overview]
Message-ID: <xmqqr1kvemid.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <pull.892.git.1614793491538.gitgitgadget@gmail.com> (Josh Hunt via GitGitGadget's message of "Wed, 03 Mar 2021 17:44:51 +0000")

"Josh Hunt via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Josh Hunt <johunt@akamai.com>
>
> Currently git branch --list foo always returns an exit status of 0 even
> when the branch being searched for does not exist. Now an error is printed
> and returns a non-zero exit status.

Explaining what happens in the current code upfront is a good thing
and is in line with the convention used in our project, which is
good.  But drop "currently" from there.

Strictly speaking, it is not "always".  In a corrupt repository, it
is likely to show a proper error message and die.

Also explaining what you want to happen before the end of the log
message is good.

But the proposed log message lacks why it is a good idea to make
such a change, which is the most important part.

If you ask me, I would say that the command was asked to show any
branches, if exist, that match the given pattern, and did what it
was asked to do without encountering any error---it just happened to
have seen 0 branch that matched.  So I think returning non-zero
status would be a bug.

Thanks.




  reply	other threads:[~2021-03-04  1:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-03 17:44 [PATCH] branch: return error when --list finds no matches Josh Hunt via GitGitGadget
2021-03-04  1:27 ` Junio C Hamano [this message]
2021-03-05  0:46   ` Josh Hunt

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=xmqqr1kvemid.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=johunt@akamai.com \
    --cc=joshua.hunt@berkeley.edu \
    /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).