Subject: Re: [RFC/PATCH] git-fetch: mega-terse fetch output

From: Johannes Sixt <[email-masked]>
Date: Fri, 19 Oct 2007 10:21:16 +0200

Shawn O. Pearce schrieb:
> $ git fetch jc
> ...
> ==> git://repo.or.cz/alt-git.git
>  * tag junio-gpg-pub ......................... (new)
>  * tag v1.5.0 .......................... (tag moved)
> 
> $ git fetch me
> ...
> ==> git://repo.or.cz/git/spearce.git
>  * branch gitk -> spearce/gitk ............... (new)
>  * branch maint -> spearce/maint
>  * branch master -> spearce/master
>  * branch next -> spearce/next
>  * branch pu -> spearce/pu ......... (forced update)
>  * branch todo -> spearce/todo ............... (new)
> 
> The width of the terminal is computed to produce the ... padding.

I like the wording of the status tags.

But the padding does not convince me. How does this look on very wide
terminals? Maybe use 80 as a maximum?

> +		if (ws_cols) {
> +			size_t n = strlen(status) + strlen(remote_name) + 2;
> +			if (op)
> +				n += 1 + strlen(op);
> +			if (local_name)
> +				n += 1 + strlen(local_name);
> +			n = ws_cols - n - strlen(reason) - 4;
> +			fputc(' ', stderr);
> +			while (n--)
> +				fputc('.', stderr);

			while (n-- > 0)

otherwise you're screwed if your terminal is too narrow.

> +static void determine_window_size(void)
> +{

#ifdef TIOCGWINSZ

> +	struct winsize ws;
> +	if (!ioctl(2, TIOCGWINSZ, &ws))
> +		ws_cols = ws.ws_col;

#endif

> +}

Pretty please. We don't have TIOCGWINSZ on Windows.

-- Hannes