Skip to content

Commit

Permalink
branch: don't fail listing branches if one of the commits wasn't found
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Simo Melenius authored and Junio C Hamano committed Jun 7, 2010
1 parent 1603ade commit 0e9716e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion builtin/branch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 0e9716e

Please sign in to comment.