git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jeff King <peff@peff.net>
Date
Oct 19, 2007, 07:57 UTC
Message-ID
<20071019075725.GA29436@coredump.intra.peff.net>
In-Reply-To
<20071019073938.GN14735@spearce.org>
On Fri, Oct 19, 2007 at 03:39:39AM -0400, Shawn O. Pearce wrote:
Show 7 quoted lines
> What about this on top of Jeff's patch?
> 
> $ git fetch jc
> ...
> ==> git://repo.or.cz/alt-git.git
>  * tag junio-gpg-pub ......................... (new)
>  * tag v1.5.0 .......................... (tag moved)
Honestly, I find it a bit ugly with the dots.
Show 9 quoted lines
> $ 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)

More so with the ragged right of the branch names. I think it would probably look better to line up the columns, but that will eventually look ugly when somebody tries to fetch sp/totally-annoying-branchname.

I also think having the dots for some lines and others looks awkward.
> The width of the terminal is computed to produce the ... padding.
> I used a very narrow terminal to produce the above so it doesn't
> linewrap badly in email.  If we cannot get the terminal width then
> we just don't produce the padding.

Ugh. I strongly suspect that it would look ugly on anything bigger than about 80 columns, anyway. You are probably better off just not worrying about the terminal width, and always using an 80-ish column total. And then you don't have to worry about the ugly ioctl call.

> We also only show the URL once now, and only if at least one ref
> was somehow changed.  This way we avoid showing the URL on a no-op
> or twice when we are fetching tags too.

Much nicer, and I like the refactoring into a separate show_update function (especially if somebody ends up adding color later).

> +			show_update("* branch", note, "->", "FETCH_HEAD", NULL);

Hrm, btw, I can't seem to get this one to show (I was curious how ugly the FETCH_HEAD would look).

Show 5 quoted lines
>  		if (verbose)
> -			fprintf(stderr, " - %s == %s\n",
> -				note, pretty_ref);
> +			show_update("-", note, "==", pretty_ref, "unchanged");
>  		return 0;

Also, I was unable to generate a test case that showed this one. Did you?

> -			msg = "storing tag";
> [...]
> +			msg = "storing new tag";
Nice.
> +		show_update("- branch", note, "->", pretty_ref, "non-fast forward, refused");
Line wrap?
Show 7 quoted lines
> +static void determine_window_size(void)
> +{
> +	struct winsize ws;
> +	if (!ioctl(2, TIOCGWINSZ, &ws))
> +		ws_cols = ws.ws_col;
> +}
> +
Ugh. How portable is this?
-Peff
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 5 of 40 in “git-fetch: mega-terse fetch output”
  1. git-fetch: mega-terse fetch outputJeff King, Oct 19, 2007
  2. David SymondsOct 19, 2007
  3. Jeff KingOct 19, 2007
  4. Shawn O. PearceOct 19, 2007
  5. Jeff KingOct 19, 2007
  6. Shawn O. PearceOct 19, 2007
  7. Jeff KingOct 19, 2007
  8. Johannes SixtOct 19, 2007
  9. Santi BéjarOct 19, 2007
  10. Theodore TsoOct 19, 2007
  11. Johannes SixtOct 19, 2007
  12. Nicolas PitreOct 19, 2007
  13. Johannes SchindelinOct 19, 2007
  14. Santi BéjarOct 19, 2007
  15. Karl HasselströmOct 19, 2007
  16. Johannes SixtOct 19, 2007
  17. Nicolas PitreOct 19, 2007
  18. Johannes SchindelinOct 19, 2007
  19. Nicolas PitreOct 19, 2007
  20. Nicolas PitreOct 19, 2007
  21. Jeff KingOct 20, 2007
  22. Shawn O. PearceOct 20, 2007
  23. Karl HasselströmOct 19, 2007
  24. Nicolas PitreOct 19, 2007
  25. Theodore TsoOct 19, 2007
  26. Nicolas PitreOct 19, 2007
  27. Theodore TsoOct 19, 2007
  28. Nicolas PitreOct 19, 2007
  29. Miles BaderOct 23, 2007
  30. Andreas EricssonOct 19, 2007
  31. Andreas EricssonOct 19, 2007
  32. Nicolas PitreOct 19, 2007
  33. Steven GrimmOct 19, 2007
  34. Steven GrimmOct 19, 2007
  35. Nicolas PitreOct 19, 2007
  36. Sam RavnborgOct 19, 2007
  37. Nicolas PitreOct 19, 2007
  38. Andreas EricssonOct 19, 2007
  39. David KastrupOct 19, 2007
  40. Jeff KingOct 19, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.