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

Re: [PATCH] graph API: Added logic for colored edges

From
Allan Caffee <allan.caffee@gmail.com>
Date
Apr 9, 2009, 22:08 UTC
Message-ID
<20090409220816.GA8234@linux.vnet>
In-Reply-To
<87hc0x7lpg.fsf@iki.fi>
On Thu, 09 Apr 2009, Teemu Likonen wrote:
Show 30 quoted lines
> On 2009-04-07 14:57 (-0400), Allan Caffee wrote:
> 
> > Modified the graph drawing logic to colorize edges based on
> > parent-child relationships similiarly to gitk.
> 
> I like the colored graph very much, thanks. Unfortunately there are some
> problems with aligning of log messages and headers. For example, try
> this in git.git repository:
> 
> 
> $ git log -1 --graph 796b137
> 
> *   commit 796b13781aecce551b8f92049a66646e60f31dce
> |\ Merge: 6da14ee db12d97
> | | Author: Junio C Hamano <gitster@pobox.com>
> | | Date:   2009-04-08 23:41:27 -0700
> 
> 
> Without colors or without your patch the alignment is correct:
> 
> $ git log -1 --graph --no-color 796b137
> 
> *   commit 796b13781aecce551b8f92049a66646e60f31dce
> |\  Merge: 6da14ee db12d97
> | | Author: Junio C Hamano <gitster@pobox.com>
> | | Date:   2009-04-08 23:41:27 -0700
> 
> 
> (Perhaps the "Merge:" header could have two spaces befor the data, but
> this is  unrelated to --graph.)

Thanks for the feedback! The problem here is that graph_horizontal_padding was counting the number of characters in the strbuf in order to decide how much whitespace to pad the row with. The ANSI escape sequences for colors and attributes are not printable characters but do contribute to the length of the strbuf. This can be fixed by adding a new function that counts only printing characters/spaces. I'll include this in my next round.

Previous: Teemu Likonen
Message 13 of 13 in “graph API: Added logic for colored edges”
  1. graph API: Added logic for colored edgesAllan Caffee, Apr 7, 2009
  2. Junio C HamanoApr 8, 2009
  3. Allan CaffeeApr 8, 2009
  4. Junio C HamanoApr 9, 2009
  5. graph API: Added logic for colored edgesAllan Caffee, Apr 9, 2009
  6. Junio C HamanoApr 12, 2009
  7. Allan CaffeeApr 12, 2009
  8. Junio C HamanoApr 12, 2009
  9. graph API: Added logic for colored edgesAllan Caffee, Apr 12, 2009
  10. Junio C HamanoApr 12, 2009
  11. graph API: Added logic for colored edgesAllan Caffee, Apr 13, 2009
  12. Teemu LikonenApr 9, 2009
  13. Allan CaffeeApr 9, 2009

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.