Re: [PATCH 1/2] branch: exit status now reflects if branch listing finds an error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>

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;
 };
-- 
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]