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>
Simo Melenius committed
Jun 4, 2010 at 12:50 UTC
0e9716e65e40883759082b35e90113d0d0c8f7a6
1 file changed
+4
-1
builtin/branch.c
+4
-1
@@ -301,7 +301,7 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,
301
commit = lookup_commit_reference_gently(sha1, 1);
302
if (!commit) {
303
cb->ret = error("branch '%s' does not point at a commit", refname);
304
- return cb->ret;
304
+ return 0;
305
}
306
307
/* Filter with with_commit if specified */
@@ -539,6 +539,9 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, stru
539
540
free_ref_list(&ref_list);
541
542
+ if (cb.ret)
543
+ error("some refs could not be read");
544
+
545
return cb.ret;
546
}
547