git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Simo Melenius <simo.melenius@iki.fi>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH 1/2] branch: exit status now reflects if branch listing finds an error
Date: Thu, 3 Jun 2010 21:24:06 -0500	[thread overview]
Message-ID: <20100604022405.GA26071@progeny.tock> (raw)
In-Reply-To: <1275551282-21557-1-git-send-email-simo.melenius@iki.fi>

Simo Melenius wrote:

> If some refs could not be read when listing branches, this can now be
> observed in the exit status of the "git branch" command.

A noble cause.  Thanks.

> +struct append_ref_cb
> +{
> +	struct ref_list *ref_list;
> +	int ret;
> +};

nitpick: the brace should go on the same line to match the other
structs in builtin/branch.c and elsewhere in git.

> @@ -496,7 +507,9 @@ static void print_ref_list(int kinds, int detached, int verbose, int abbrev, str
>  	ref_list.with_commit = with_commit;
>  	if (merge_filter != NO_FILTER)
>  		init_revisions(&ref_list.revs, NULL);
> -	for_each_rawref(append_ref, &ref_list);
> +	cb.ref_list = &ref_list;
> +	cb.ret = 0;
> +	for_each_rawref(append_ref, &cb);
>  	if (merge_filter != NO_FILTER) {
>  		struct commit *filter;
>  		filter = lookup_commit_reference_gently(merge_filter_ref, 0);

This can be simplified by "ret = for_each_rawref(append_ref, ..."
but the above would have to be added back anyway for patch 2/2.  So
I’m happy with this patch as is.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

diff --git a/builtin/branch.c b/builtin/branch.c
index 46ca59c..77ae444 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -257,8 +257,7 @@ static char *resolve_symref(const char *src, const char *prefix)
 	return xstrdup(dst);
 }
 
-struct append_ref_cb
-{
+struct append_ref_cb {
 	struct ref_list *ref_list;
 	int ret;
 };
-- 

  reply	other threads:[~2010-06-04  2:23 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 [this message]
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

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=20100604022405.GA26071@progeny.tock \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=simo.melenius@iki.fi \
    /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).