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

Re: What's cooking in git.git (Mar 2010, #01; Wed, 03)

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 5, 2010, 03:23 UTC
Message-ID
<7v7hprh2ot.fsf@alter.siamese.dyndns.org>
In-Reply-To
<ca433831003041730w7ccbc953kad3b600e7b112e0e@mail.gmail.com>
Mark Lodato <lodatom@gmail.com> writes:
Show 10 quoted lines
> The disagreement is whether --name-only output should be colored or
> not.  In the patch, it is not, which I argue makes more sense.  When
> --name-only is given, the only thing output is filenames.  Having them
> all be the same color adds no information, and I personally find it
> annoying to see one big block of the same color. GNU grep does color
> the filenames with --name-only.  Michael Witten argues that this makes
> the output consistent: whenever it's a filename, it's colored. [1]  He
> also thinks that matching GNU grep's behavior is important.  He didn't
> convince me and I didn't convince him, so it would be nice to have
> more opinions on this.

I don't have a very strong preference, but I would say painting filenames in --name-only output the same way would make more sense than not doing so, as it is obviously consistent if we paint the name of the file exactly the same way whenever we write it at the leftmost column as the hit label, no matter what options are in effect, e.g. -c, -l, or nothing.

As to the coloring of <foo> in "Binary file <foo> matches", I don't think it matters very much which way you choose. That string is an oddball to begin with---it isn't even prefixed with the filename like normal "hit" is:

    $ git grep Q t/test4*.png t/Makefile
    Binary file t/test4012.png matches
    t/Makefile:SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
    t/Makefile:     @echo "*** $@ ***"; GIT_CONFIG=.git/config ...
    t/Makefile:     '$(SHELL_PATH_SQ)' ./aggregate-results.sh test-results/t*-*    

and I think it is deliberately made an oddball, i.e. it shouldn't be like this:

    $ git grep Q t/test4*.png t/Makefile
    t/test4012.png: Binary file t/test4012.png matches
    t/Makefile:SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
    t/Makefile:     @echo "*** $@ ***"; GIT_CONFIG=.git/config ...
    t/Makefile:     '$(SHELL_PATH_SQ)' ./aggregate-results.sh test-results/t*-*    

because if you did so, you cannot tell if t/test4012.png is a binary file, or it has that matched string anymore (well you can---the string doesn't have Q, but I think you know what I mean).

That makes me think that it is not even violating consistency if we treat the <foo> in "Binary file <foo> matches" differently from the usual filename label at the leftmost column. We do not have to be consistent there, as the whole point of the line being an oddball is because it fundamentally wants to be shown differently.

On the other hand, painting <foo> in the same "filename" color may make it easier to spot for color-loving people.

IOW, you can argue both ways, and both argument equally makes sense. That is why I don't think it matters very much.

And in such a case, it is typically safer to follow existing practices if there are any. If GNU paints it, we should. If GNU doesn't, we probably shouldn't.

Previous: Mark LodatoNext: Miklos Vajna
Message 15 of 38 in “What's cooking in git.git (Mar 2010, #01; Wed, 03)”
  1. Junio C HamanoMar 4, 2010
  2. Adam SimpkinsMar 4, 2010
  3. Björn GustavssonMar 4, 2010
  4. Junio C HamanoMar 4, 2010
  5. Tay Ray ChuanMar 4, 2010
  6. Junio C HamanoMar 4, 2010
  7. Junio C HamanoMar 4, 2010
  8. Junio C HamanoMar 5, 2010
  9. git reset --keep (Re: What's cooking in git.git (Mar 2010, #01; Wed, 03))Jonathan Nieder, Mar 5, 2010
  10. Christian CouderMar 5, 2010
  11. Christian CouderMar 5, 2010
  12. Thomas RastMar 4, 2010
  13. Mark LodatoMar 5, 2010
  14. Mark LodatoMar 5, 2010
  15. Junio C HamanoMar 5, 2010
  16. Add tests for git format-patch --to and format.to config optionMiklos Vajna, Mar 6, 2010
  17. Junio C HamanoMar 6, 2010
  18. format-patch --to: overwrite format.to contents, don't append itMiklos Vajna, Mar 6, 2010
  19. Stephen BoydMar 7, 2010
  20. Miklos VajnaMar 7, 2010
  21. Junio C HamanoMar 7, 2010
  22. Stephen BoydMar 7, 2010
  23. Junio C HamanoMar 7, 2010
  24. 0/4 format-patch and send-email ignoring config settingsStephen Boyd, Mar 7, 2010
  25. 0/3 format-patch and send-email ignoring config settingsStephen Boyd, Mar 7, 2010
  26. 1/3 format-patch: use a string_list for headersStephen Boyd, Mar 7, 2010
  27. 2/3 format-patch: add --no-cc, --no-to, and --no-add-headersStephen Boyd, Mar 7, 2010
  28. 3/3 send-email: add --no-cc, --no-to, and --no-bccStephen Boyd, Mar 7, 2010
  29. Junio C HamanoMar 9, 2010
  30. 1/4 send-email: actually add bcc headersStephen Boyd, Mar 7, 2010
  31. Stephen BoydMar 7, 2010
  32. 2/4 format-patch: use a string_list for headersStephen Boyd, Mar 7, 2010
  33. Erik Faye-LundMar 7, 2010
  34. Stephen BoydMar 7, 2010
  35. Johannes SchindelinMar 7, 2010
  36. 3/4 format-patch: add --no-cc, --no-to, and --no-add-headersStephen Boyd, Mar 7, 2010
  37. 4/4 send-email: add --no-cc, --no-to, and --no-bccStephen Boyd, Mar 7, 2010
  38. Steven DrakeMar 10, 2010

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.