From: Matthieu Moy Date: Fri, 03 Aug 2007 23:01:23 GMT Subject: Re: [PATCH] Add --show-touched option to show "diff --git" line when contents are unchanged Message-ID: In-Reply-To: <7v1wekmgo8.fsf@assigned-by-dhcp.cox.net> Junio C Hamano writes: > Matthieu Moy 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