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

Re: [PATCH] use natural ordering to display list of branches.

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jun 5, 2008, 18:47 UTC
Message-ID
<alpine.DEB.1.00.0806051946100.21190@racer>
In-Reply-To
<d45085aa0806051041y42ce467fq2e07371d225ccca3@mail.gmail.com>
Hi,
On Thu, 5 Jun 2008, Cedric Vivier wrote:
Show 23 quoted lines
> Hi everyone,
> 
> This small patch makes git display list of branches in natural order.
> This way, when you name your branches against, for instance, a bug number from
> some bug-tracking tool, the list will show up in a natural/human/logical order.
> 
> Current behavior for "git branch":
> BUG-1040-doing-bar-is-too-slow
> BUG-84-calling-Z-with-null-segfaults
> BUG-900-program-freezes-when-user-click-on-button
> experimental-feature-X
> master
> 
> With the patch:
> BUG-84-calling-Z-with-null-segfaults
> BUG-900-program-freezes-when-user-click-on-button
> BUG-1040-doing-bar-takes-too-much-time
> experimental-feature-X
> master
> 
> 
> Signed-off-by: Cedric Vivier <cedricv@neonux.com>
> ---
This is not a good commit message.
Show 9 quoted lines
> @@ -279,7 +280,7 @@ static int ref_cmp(const void *r1, const void *r2)
> 
>  	if (c1->kind != c2->kind)
>  		return c1->kind - c2->kind;
> -	return strcmp(c1->name, c2->name);
> +	return strnatcmp(c1->name, c2->name);
>  }
> 
>  static void print_ref_item(struct ref_item *item, int maxwidth, int verbose,

What about people preferring the status quo? I think a command line option would be in order.

Also, you _might_ want to provide a test case, so that it does not get broken by accident.

Other than that: nice.

Ciao, Dscho

Previous: Cedric VivierNext: Junio C Hamano
Message 2 of 27 in “use natural ordering to display list of branches.”
  1. use natural ordering to display list of branches.Cedric Vivier, Jun 5, 2008
  2. Johannes SchindelinJun 5, 2008
  3. Junio C HamanoJun 5, 2008
  4. Johannes SchindelinJun 5, 2008
  5. Cedric VivierJun 5, 2008
  6. Marius Storm-OlsenJun 5, 2008
  7. Paolo BonziniJun 6, 2008
  8. Johannes SchindelinJun 6, 2008
  9. Sverre RabbelierJun 6, 2008
  10. Paolo BonziniJun 6, 2008
  11. Brandon CaseyJun 6, 2008
  12. Cedric VivierJun 6, 2008
  13. Brandon CaseyJun 6, 2008
  14. Johannes SchindelinJun 6, 2008
  15. Junio C HamanoJun 6, 2008
  16. Asheesh LaroiaJun 6, 2008
  17. Jeff KingJun 7, 2008
  18. Cedric VivierJun 7, 2008
  19. Junio C HamanoJun 7, 2008
  20. Cedric VivierJun 7, 2008
  21. Junio C HamanoJun 7, 2008
  22. しらいしななこJun 6, 2008
  23. Ask Bjørn HansenJun 15, 2008
  24. Mike RalphsonJun 6, 2008
  25. Cedric VivierJun 6, 2008
  26. Mike RalphsonJun 6, 2008
  27. Andreas EricssonJun 9, 2008

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.