git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simo Melenius <simo.melenius@iki.fi>
To: jrnieder@gmail.com
Cc: git@vger.kernel.org, Simo Melenius <simo.melenius@iki.fi>
Subject: [PATCH 2/2] branch: don't fail listing branches if one of the commits wasn't found
Date: Thu,  3 Jun 2010 10:48:02 +0300	[thread overview]
Message-ID: <1275551282-21557-2-git-send-email-simo.melenius@iki.fi> (raw)
In-Reply-To: <20100603065527.GA23439@progeny.tock>

When listing branches with ref lookups, if one of the known raw refs
doesn't point to a commit then "git branch" would return error(),
terminating the whole for_each_rawref() iteration and possibly hiding
any remaining refs.

Signed-off-by: Simo Melenius <simo.melenius@iki.fi>
---
 builtin/branch.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index 46ca59c..2242743 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -303,7 +303,7 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,
 		if (!commit)
 		{
 			cb->ret = error("branch '%s' does not point at a commit", refname);
-			return cb->ret;
+			return 0;
 		}
 
 		/* Filter with with_commit if specified */
@@ -541,6 +541,9 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, stru
 
 	free_ref_list(&ref_list);
 
+	if (cb.ret)
+		error("some refs could not be read, review stderr");
+
 	return cb.ret;
 }
 
-- 
1.7.0.4

  parent reply	other threads:[~2010-06-03  7:49 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
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       ` Simo Melenius [this message]
2010-06-03 17:42         ` [PATCH 2/2] branch: don't fail listing branches if one of the commits wasn't found 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=1275551282-21557-2-git-send-email-simo.melenius@iki.fi \
    --to=simo.melenius@iki.fi \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    /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).