Re: [PATCH] remote show: fix the -n option

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

 



Hi,

On Mon, 9 Jun 2008, Olivier Marin wrote:

> The perl version accepted a -n flag, to show local informations only 
> without querying remote heads, that seems to have been lost in the C 
> rewrite.

Would have been nice to Cc: the author of the C rewrite.

> diff --git a/builtin-remote.c b/builtin-remote.c
> index c49f00f..cb9e282 100644
> --- a/builtin-remote.c
> +++ b/builtin-remote.c
> @@ -421,10 +421,10 @@ static void show_list(const char *title, struct path_list *list)
>  
>  static int show_or_prune(int argc, const char **argv, int prune)
>  {
> -	int dry_run = 0, result = 0;
> +	int no_query = 0, result = 0;

Why?

>  	struct option options[] = {
>  		OPT_GROUP("show specific options"),
> -		OPT__DRY_RUN(&dry_run),
> +		OPT_BOOLEAN('n', NULL, &no_query, "do not query remotes"),

Why?


> +			transport = transport_get(NULL, states.remote->url_nr > 0 ?

Please rewrap.

> @@ -486,17 +490,17 @@ static int show_or_prune(int argc, const char **argv, int prune)
>  			printf("\n");
>  		}
>  
> -		if (got_states)
> -			continue;
> -		strbuf_init(&buf, 0);
> -		strbuf_addf(&buf, "  New remote branch%%s (next fetch will "
> -			"store in remotes/%s)", states.remote->name);
> -		show_list(buf.buf, &states.new);
> -		strbuf_release(&buf);
> -		show_list("  Stale tracking branch%s (use 'git remote prune')",
> -				&states.stale);
> -		show_list("  Tracked remote branch%s",
> -				&states.tracked);
> +		if (!got_states) {
> +			strbuf_init(&buf, 0);
> +			strbuf_addf(&buf, "  New remote branch%%s (next fetch will "
> +				"store in remotes/%s)", states.remote->name);
> +			show_list(buf.buf, &states.new);
> +			strbuf_release(&buf);
> +			show_list("  Stale tracking branch%s (use 'git remote prune')",
> +					&states.stale);
> +			show_list("  Tracked remote branch%s",
> +					&states.tracked);
> +		}
>  
>  		if (states.remote->push_refspec_nr) {
>  			printf("  Local branch%s pushed with 'git push'\n   ",

Maybe we need two different values of got_states; not calling ls-remote 
and then showing things is okay, but calling ls-remote, getting an error 
and _then_ showing stuff is not okay, IMO.

Thanks,
Dscho

--
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]

  Powered by Linux