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 5, 2007, 19:42 UTC
Message-ID
<vpqr6mhahtx.fsf@bauges.imag.fr>
In-Reply-To
<7vlkcskx5z.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <gitster@pobox.com> writes:
Show 11 quoted lines
> Matthieu Moy <Matthieu.Moy@imag.fr> writes:
>
>>> "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?
>
> Think of what "git commit -a" would have to do.

I don't know whether it was a typo, but we're not talking about "commit", but "status".

> It needs to hash and deposit a new object for blobs that have been
> modified. Where do those new blob object go?

git-status _does_ hash and deposit new objects, but it doesn't _need_ to. It can very well show you what "commit -a" would do without actually doing it.

A trivial (and very stupid, yes) way to do this would be

cp -r . /tmp/git/ cd /tmp/git git-status -a

There's no visible side-effects for the user.

IIRC, git-status -a does actually "git-add" the modified objects, but does so in a temporary index, so I believe the objects you leave in the objects database are not pointed to by anyone (indeed, I just checked, git-fsck --unreachable shows the dangling blob), and are not really useful (but will probably be used later when you run commit or add).

Show 6 quoted lines
> Maybe in a theoretical ideal world, you might prefer to
> reverting back to the stat-dirty original index to make
> git-status appear a read-only operation, with continued degraded
> performance.  You are welcome to reimplement it that way, and
> the patch should be trivial (while git-commit.sh is still a
> script, at least) but that is not what we did.

You still didn't understand my point about the difference between user-specification and internal behavior. I'm very happy with git-status updating the stat information in the index, since it is not suppose to have user-visible side effects (it has with the current empty-diff-for-touched-files behavior of git-diff).

Now, at that point, if I still didn't manage to show you the difference between user-visible behavior and implementation, I believe I have no better thing to do than giving up.

-- 
Matthieu
Previous: Junio C HamanoNext: Johannes Schindelin
Message 24 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.