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

Re: [PATCH] parse_color: fix return value for numeric color values 0-8

From
Jeff King <peff@peff.net>
Date
Jan 21, 2015, 00:03 UTC
Message-ID
<20150121000352.GA12543@peff.net>
In-Reply-To
<xmqqvbk1ypie.fsf@gitster.dls.corp.google.com>
On Tue, Jan 20, 2015 at 03:57:13PM -0800, Junio C Hamano wrote:
Show 11 quoted lines
> > -- >8 --
> > When commit 695d95d refactored the color parsing, it missed
> > a "return 0" when parsing literal numbers 0-8 (which
> > represent basic ANSI colors), leading us to report these
> > colors as an error.
> >
> > Signed-off-by: Jeff King <peff@peff.net>
> > ---
> 
> Thanks; somebody should have caught this before we applied and
> merged to 'master', but the process obviously did not work well.

I am not too surprised. The use of numeric values for colors was completely undocumented, and we did not have any test coverage for it. I did not even know it existed until I started refactoring the function, and wondered what was going on (though I did try to preserve it once I found it).

So I suspect that almost nobody is using this undocumented "feature", which is why it was not caught while cooking in 'next'. The system cannot always have perfect output, but hopefully the number of people affected by a bug is proportional to the quickness with which it is caught.

-Peff
PS All that being said, I think it is a good example of why it is a good
   idea to beef up test coverage in an area before refactoring. A
   trivial test would have caught this.
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 7 in “[ANNOUNCE] Git v2.3.0-rc0”
  1. Junio C HamanoJan 12, 2015
  2. Christian NeukirchenJan 14, 2015
  3. Ævar Arnfjörð BjarmasonJan 20, 2015
  4. parse_color: fix return value for numeric color values 0-8Jeff King, Jan 20, 2015
  5. Junio C HamanoJan 20, 2015
  6. Jeff KingJan 21, 2015
  7. Junio C HamanoJan 21, 2015

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.