aboutsummaryrefslogtreecommitdiff
path: root/builtin/branch.c
diff options
context:
space:
mode:
authorSimo Melenius <simo.melenius@iki.fi>2010-06-04 12:50:11 +0300
committerJunio C Hamano <gitster@pobox.com>2010-06-07 15:50:00 -0700
commit0e9716e65e40883759082b35e90113d0d0c8f7a6 (patch)
tree65239c4fffe39dce395e71ca74a34622e30804bd /builtin/branch.c
parent1603ade81352a526ccb206f41ff81ecbc855df2d (diff)
downloadgit-0e9716e65e40883759082b35e90113d0d0c8f7a6.tar.gz
git-0e9716e65e40883759082b35e90113d0d0c8f7a6.tar.xz
branch: don't fail listing branches if one of the commits wasn't found
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> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/branch.c')
-rw-r--r--builtin/branch.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/branch.c b/builtin/branch.c
index 5f0873ab6..a92de9a06 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -301,7 +301,7 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,
commit = lookup_commit_reference_gently(sha1, 1);
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 */
@@ -539,6 +539,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");
+
return cb.ret;
}