git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug? "git branch" failing to list all branches
@ 2010-06-02 14:47 Simo Melenius
  2010-06-03  4:22 ` Jonathan Nieder
  0 siblings, 1 reply; 12+ messages in thread
From: Simo Melenius @ 2010-06-02 14:47 UTC (permalink / raw)
  To: git

I consider this a bug and wrote a fix. I would now like to ask the git
maintainers' opinion with regard to it.

When listing branches, "git branch" will in certain cases terminate
iteration at the first broken ref that doesn't point to a commit. This
will silently hide any remaining refs from the output listing.
However, this failure is not communicated upwards either, so I think
append_ref() goes wrong to terminate the whole loop because of this.

I noticed this because "git branch -a" and "git branch -av"
unexpectedly gave a very different output.


Simo

diff --git a/builtin/branch.c b/builtin/branch.c
index 6cf7e72..1a8e3d3 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -294,7 +294,10 @@ static int append_ref(const char *refname, const
unsigned char *sha1, int flags,
        if (ref_list->verbose || ref_list->with_commit || merge_filter
!= NO_FILTER) {
                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;
+               }

                /* Filter with with_commit if specified */
                if (!is_descendant_of(commit, ref_list->with_commit))

-- 
() Today is the car of the cdr of your life.
/\ http://arc.pasp.de/

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-06-04  9:53 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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       ` [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

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).