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

Re: [PATCH 2/6] show: obey --textconv for blobs

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Apr 22, 2013, 10:29 UTC
Message-ID
<517510F6.7040301@drmicha.warpmail.net>
In-Reply-To
<20130421033710.GA18890@sigill.intra.peff.net>
Jeff King venit, vidit, dixit 21.04.2013 05:37:
Show 52 quoted lines
> On Sat, Apr 20, 2013 at 03:38:53PM +0200, Michael J Gruber wrote:
> 
>>> Wait, this does the opposite of the last patch. If we do want to do
>>> this, shouldn't the last one have been an "expect_failure"?
>>
>> The last patch just documents the status quo, which is not a bug per se.
>> Therefore, no failure, but change in the definition of "success".
> 
> IMHO, the series is easier to review if you it does not go back and
> forth. If you have one patch that says "X is the right behavior", and
> then another patch that flips it to say "Y is the right behavior", the
> reviewer would read each in sequence and want to be convinced by your
> arguments for X and Y. But you probably cannot make a good argument for
> X if you are trying to end up at Y. :)
> 
> So I'd much rather see the test introduced with the desired end
> behavior, marked as expect_failure, and the commit message contain an
> argument about why Y is a good thing (and squashing the tests in with
> the actual fix is often even better, because the fix itself would want
> to contain the same argument).
> 
> Just my two cents as a reviewer.
> 
>> My reasoning is twofold:
>>
>> - consistency between "git show commit" and "git show blob"
> 
> I'm not sure I agree with this line of reasoning. "git show commit" is
> showing a diff, not the file contents; textconv has always been about
> munging the contents to produce a textual diff. It may be reasonable to
> extend its definition to "this is the preferred human view of this
> content, and that happens to be what you would want to produce a diff".
> But I do not think it is necessarily inconsistent not to apply it for
> the blob case.
> 
>> - "git show" is a user facing command, and as such should produce output
>> consumable by humans; whereas "git cat-file" is plumbing and should
>> produce raw data unless told otherwise (-p, --textconv).
> 
> That holds if the textconv is the only (or best) human-readable version
> of the file. And maybe that is reasonable. But is it possible that
> somebody uses "textconv" to produce a better diff of some already
> human-readable format? For example, imagine I define a textconv for XML
> files that normalizes the formatting to make diffs less noisy. When I am
> not looking at a diff, what is the best human-readable version? The
> original, or the normalized one? I'm not sure.
> 
> Note that I'm somewhat playing devil's advocate here. For the cases
> where I have used textconv in the real world, I think I would probably
> prefer seeing the converted contents, and I am happy to call it user
> error if I use "git show HEAD:foo.jpg >bar.jpg" accidentally. But I also
> want to make sure we are not regressing somebody else unnecessarily.

Yes, the thing is that textconv helps diff by converting content (to text) before the (textual) diff. So it's somehow a double-faced beast.

It's clearly activated by a "diff" attribute; so that would be a strong argument against my patch, at least against defaulting to --textconv for blobs.

OTOH, textconv does have this aspect of converting text to a form digestable by humans (pre-diff, granted), which is the argument for defaulting to --textconv in porcellain.

We could use a separate attribute "show" in addition to "diff", but I don't think it's worth going there, unless there is a strong use case for "diff-specific textconv" which one would not want to apply when showing just the content.

Michael
Previous: Jeff KingNext: Junio C Hamano
Message 9 of 77 in “grep with textconv”
  1. 0/6 grep with textconvMichael J Gruber, Apr 19, 2013
  2. 1/6 t4030: demonstrate behavior of show with textconvMichael J Gruber, Apr 19, 2013
  3. Jeff KingApr 20, 2013
  4. Michael J GruberApr 20, 2013
  5. 2/6 show: obey --textconv for blobsMichael J Gruber, Apr 19, 2013
  6. Jeff KingApr 20, 2013
  7. Michael J GruberApr 20, 2013
  8. Jeff KingApr 21, 2013
  9. Michael J GruberApr 22, 2013
  10. Junio C HamanoApr 22, 2013
  11. Jeff KingApr 22, 2013
  12. Jeremy RosenApr 22, 2013
  13. Matthieu MoyApr 22, 2013
  14. Michael J GruberApr 23, 2013
  15. 3/6 cat-file: do not die on --textconv without textconv filtersMichael J Gruber, Apr 19, 2013
  16. Junio C HamanoApr 19, 2013
  17. Jeff KingApr 20, 2013
  18. Michael J GruberApr 20, 2013
  19. 4/6 t7008: demonstrate behavior of grep with textconvMichael J Gruber, Apr 19, 2013
  20. 5/6 grep: allow to use textconv filtersMichael J Gruber, Apr 19, 2013
  21. Jeff KingApr 20, 2013
  22. 6/6 grep: obey --textconv for the case rev:pathMichael J Gruber, Apr 19, 2013
  23. Jeff KingApr 20, 2013
  24. Michael J GruberApr 20, 2013
  25. Jeff KingApr 21, 2013
  26. Junio C HamanoApr 19, 2013
  27. Jeff KingApr 20, 2013
  28. Michael J GruberApr 20, 2013
  29. 0/7 grep with textconvMichael J Gruber, Apr 23, 2013
  30. 1/7 t4030: demonstrate behavior of show with textconvMichael J Gruber, Apr 23, 2013
  31. Junio C HamanoApr 23, 2013
  32. 2/7 show: obey --textconv for blobsMichael J Gruber, Apr 23, 2013
  33. Junio C HamanoApr 23, 2013
  34. Michael J GruberApr 24, 2013
  35. Junio C HamanoApr 24, 2013
  36. 3/7 cat-file: do not die on --textconv without textconv filtersMichael J Gruber, Apr 23, 2013
  37. Junio C HamanoApr 23, 2013
  38. 4/7 t7008: demonstrate behavior of grep with textconvMichael J Gruber, Apr 23, 2013
  39. Junio C HamanoApr 23, 2013
  40. Michael J GruberApr 24, 2013
  41. Junio C HamanoApr 24, 2013
  42. 5/7 grep: allow to use textconv filtersMichael J Gruber, Apr 23, 2013
  43. 6/7 grep: honor --textconv for the case rev:pathMichael J Gruber, Apr 23, 2013
  44. 7/7 git grep: honor textconv by defaultMichael J Gruber, Apr 23, 2013
  45. Junio C HamanoApr 23, 2013
  46. Michael J GruberApr 24, 2013
  47. Junio C HamanoApr 24, 2013
  48. Matthieu MoyApr 24, 2013
  49. Junio C HamanoApr 24, 2013
  50. Michael J GruberApr 26, 2013
  51. Matthieu MoyApr 26, 2013
  52. Michael J GruberApr 29, 2013
  53. Junio C HamanoApr 29, 2013
  54. 1/7 t4030: demonstrate behavior of show with textconvMichael J Gruber, May 10, 2013
  55. 2/7 diff_opt: track whether flags have been set explicitlyMichael J Gruber, May 10, 2013
  56. Eric SunshineMay 10, 2013
  57. 3/7 show: honor --textconv for blobsMichael J Gruber, May 10, 2013
  58. Junio C HamanoMay 10, 2013
  59. Jeff KingMay 10, 2013
  60. Junio C HamanoMay 10, 2013
  61. Jeff KingMay 11, 2013
  62. Junio C HamanoMay 11, 2013
  63. Michael J GruberMay 11, 2013
  64. Michael J GruberMay 11, 2013
  65. Junio C HamanoMay 13, 2013
  66. Jeff KingMay 13, 2013
  67. Michael J GruberMay 13, 2013
  68. Junio C HamanoMay 13, 2013
  69. Jeff KingMay 16, 2013
  70. Junio C HamanoMay 11, 2013
  71. Michael J GruberMay 12, 2013
  72. 4/7 cat-file: do not die on --textconv without textconv filtersMichael J Gruber, May 10, 2013
  73. 5/7 t7008: demonstrate behavior of grep with textconvMichael J Gruber, May 10, 2013
  74. 6/7 grep: allow to use textconv filtersMichael J Gruber, May 10, 2013
  75. 7/7 grep: honor --textconv for the case rev:pathMichael J Gruber, May 10, 2013
  76. Junio C HamanoMay 10, 2013
  77. Junio C HamanoMay 10, 2013

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.