From: Jonathan Nieder <jrnieder@gmail.com>
To: Simo Melenius <simo.melenius@iki.fi>
Cc: git@vger.kernel.org
Subject: Re: Bug? "git branch" failing to list all branches
Date: Wed, 2 Jun 2010 23:22:18 -0500 [thread overview]
Message-ID: <20100603042218.GA21254@progeny.tock> (raw)
In-Reply-To: <AANLkTimTOucIfzSxsYNvmML7MALwj0E3BUASIIKIN1lN@mail.gmail.com>
Hi Simo,
Simo Melenius wrote:
> I noticed this because "git branch -a" and "git branch -av"
> unexpectedly gave a very different output.
Hmm --- so the error message must not have been very visible...
> When listing branches, "git branch" will in certain cases terminate
> iteration at the first broken ref that doesn't point to a commit.
Even in a broken repository, the full branch list would be useful for
getting one’s bearings. Thanks.
> commit = lookup_commit_reference_gently(sha1, 1);
> if (!commit)
> - return error("branch '%s' does not point at a
> commit", refname);
> + {
> + error("branch '%s' does not point at a
> commit", refname);
> + return 0;
> + }
Will this make ‘git branch’ exit with status zero? Scripts and people
with fancy prompts benefit from a nonzero exit status.
If I have 37 branches and an error is encountered looking up one of
them, with this patch the error message will scroll off the screen.
Is this worth worrying about? It depends on what the usual causes for
broken branch refs are and whether they require attention or can be
safely ignored.
One other thought: this patch is line-wrapped, which means it cannot
be mechanically applied. Documentation/SubmittingPatches has some
tips on sending a patch unmangled (and please also see the section
labelled "Sign your work").
Cheers,
Jonathan
next prev parent reply other threads:[~2010-06-03 4:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-02 14:47 Bug? "git branch" failing to list all branches Simo Melenius
2010-06-03 4:22 ` Jonathan Nieder [this message]
2010-06-03 6:00 ` Simo Melenius
2010-06-03 6:55 ` Jonathan Nieder
2010-06-03 7:48 ` [PATCH 1/2] branch: exit status now reflects if branch listing finds an error Simo Melenius
2010-06-04 2:24 ` Jonathan Nieder
2010-06-03 7:48 ` [PATCH 2/2] branch: don't fail listing branches if one of the commits wasn't found Simo Melenius
2010-06-03 17:42 ` Sverre Rabbelier
2010-06-04 2:43 ` Jonathan Nieder
2010-06-04 9:48 ` Simo Melenius
2010-06-04 9:50 ` [PATCH 1/2] branch: exit status now reflects if branch listing finds an error Simo Melenius
2010-06-04 9:50 ` [PATCH 2/2] branch: don't fail listing branches if one of the commits wasn't found Simo Melenius
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100603042218.GA21254@progeny.tock \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=simo.melenius@iki.fi \
/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.
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 NNTP newsgroup(s).