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

Re: [PATCH] Add --show-touched option to show "diff --git" line when contents are unchanged

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
Aug 3, 2007, 23:01 UTC
Message-ID
<vpqir7wi5oc.fsf@bauges.imag.fr>
In-Reply-To
<7v1wekmgo8.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <gitster@pobox.com> writes:
Show 12 quoted lines
> Matthieu Moy <Matthieu.Moy@imag.fr> writes:
>
>> Also, is there any particular reason not to update the index stat
>> information when files are found to be identical?
>
> Very much --- diff is a read-only operation.
>
> "git-status $args" on the other hand is a preview of "what would
> happen if I say 'git-commit $args'", and in order to compute
> that, you would fundamentally need to be able to write into the
> object store.  In a special case of giving empty $args it can be
> read-only.
Can you give an example where it _could_ not be read-only?
> The commit Dscho quoted earlier was to hack that around so that
> "git-status" can pretend to be a read-only operation in a repository
> you do not have write permission to.
I really, really, really, don't understand your argument.
There are two different concepts:
* Should git-diff be "read-only for the user"?
  (i.e. external specification)
* Should git-diff be actually read-only for the filesystem?
  (i.e. implementation)

"read-only for the user" is a user-interface thing. It just means that running

$ git-diff >& /dev/null; whatever
will give the same result as
$ whatever

In another context, "cat", for example, is a read-only operation for the user. I can run "cat whatever-file" without influencing the behavior of subsequent operations. Now, somewhere in the kernel of my OS, I do hope that reading this file will have side-effects (putting the file in the cache, and why not decide to physically move the file on disk).

Here, obviously, git-diff is a read-only operation for the user. I don't expect git-diff to modify the behavior of subsequent commands, but I appreciate if git-diff can improve the speed of subsequent commands.

Now, both of us agree that git-status should not be read-only for the filesystem, both of us agree that git-diff should be read-only for the user, but we disagree on the two other cases.

In the same way, I expect git-status to be read-only for the user. You say "what _would_ happen _if_ I say commit $args". But you don't commit, the sentence is conditionnal. I don't expect any tool to have visible side-effects when I say "what would happen if ...".

-- 
Matthieu
Previous: Junio C HamanoNext: Junio C Hamano
Message 22 of 75 in “git-diff on touched files: bug or feature?”
  1. Matthieu MoyAug 1, 2007
  2. Junio C HamanoAug 1, 2007
  3. Alexandre JulliardAug 1, 2007
  4. Junio C HamanoAug 1, 2007
  5. Alexandre JulliardAug 1, 2007
  6. Matthieu MoyAug 2, 2007
  7. Johannes SchindelinAug 2, 2007
  8. Matthieu MoyAug 2, 2007
  9. Johannes SchindelinAug 2, 2007
  10. Jean-François VeilletteAug 2, 2007
  11. Johannes SchindelinAug 2, 2007
  12. Steven GrimmAug 2, 2007
  13. Johannes SchindelinAug 2, 2007
  14. Matthieu MoyAug 2, 2007
  15. J. Bruce FieldsAug 2, 2007
  16. Add --show-touched option to show "diff --git" line when contents are unchangedSteven Grimm, Aug 3, 2007
  17. Junio C HamanoAug 3, 2007
  18. Johannes SchindelinAug 3, 2007
  19. Junio C HamanoAug 3, 2007
  20. Matthieu MoyAug 3, 2007
  21. Junio C HamanoAug 3, 2007
  22. Matthieu MoyAug 3, 2007
  23. Junio C HamanoAug 3, 2007
  24. Matthieu MoyAug 5, 2007
  25. Johannes SchindelinAug 5, 2007
  26. Matthieu MoyAug 5, 2007
  27. Matthias LederhoferAug 6, 2007
  28. David KastrupAug 6, 2007
  29. David KastrupAug 6, 2007
  30. Matthieu MoyAug 6, 2007
  31. Junio C HamanoAug 6, 2007
  32. David KastrupAug 7, 2007
  33. J. Bruce FieldsAug 7, 2007
  34. Linus TorvaldsAug 7, 2007
  35. Junio C HamanoAug 7, 2007
  36. David KastrupAug 7, 2007
  37. Linus TorvaldsAug 8, 2007
  38. Junio C HamanoAug 8, 2007
  39. Johannes SchindelinAug 8, 2007
  40. Junio C HamanoAug 8, 2007
  41. David KastrupAug 8, 2007
  42. Johannes SchindelinAug 8, 2007
  43. Jakub NarebskiAug 8, 2007
  44. Steven GrimmAug 7, 2007
  45. Add a note about the index being updated by git-status in some casesSteven Grimm, Aug 7, 2007
  46. git-diff: Output a warning about stale files in the indexSteven Grimm, Aug 7, 2007
  47. Junio C HamanoAug 7, 2007
  48. git-diff: Output a warning about stale files in the indexSteven Grimm, Aug 7, 2007
  49. Junio C HamanoAug 7, 2007
  50. Steven GrimmAug 7, 2007
  51. Jakub NarebskiAug 7, 2007
  52. Junio C HamanoAug 11, 2007
  53. Linus TorvaldsAug 8, 2007
  54. Steven GrimmAug 7, 2007
  55. Matthieu MoyAug 7, 2007
  56. Junio C HamanoAug 2, 2007
  57. Junio C HamanoAug 2, 2007
  58. Junio C HamanoAug 2, 2007
  59. Matthieu MoyAug 2, 2007
  60. Johannes SchindelinAug 2, 2007
  61. Junio C HamanoAug 2, 2007
  62. Jeff KingAug 3, 2007
  63. Junio C HamanoAug 3, 2007
  64. Jeff KingAug 3, 2007
  65. Junio C HamanoAug 3, 2007
  66. Shawn O. PearceAug 3, 2007
  67. Junio C HamanoAug 3, 2007
  68. Matthieu MoyAug 2, 2007
  69. Johannes SchindelinAug 2, 2007
  70. Matthieu MoyAug 2, 2007
  71. Johannes SchindelinAug 2, 2007
  72. Matthieu MoyAug 2, 2007
  73. Johannes SchindelinAug 2, 2007
  74. Joel ReedAug 2, 2007
  75. Johannes SchindelinAug 2, 2007

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.