On 2/9/07, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
And you wouldn't think that it really needs write access, and you'd be largely correct, EXCEPT for the fact that git status actually does a refresh of the index, to make sure that we don't claim that something is dirty just because somebody has touched the file. IOW, there's an implicit "git update-index --refresh" as part of calculating the status, and that's the thing that wants to lock the index file (and thus write to the filesystem).
------ cut ------
You *can* just use "git-runstatus" instead. That's the command that actually does all the heavy lifting. But you can see the difference by doing this: touch Makefile git runstatus vs touch Makefile git status Notice how the "runstatus" one claims that Makefile is "modified:". That's exactly because it doesn't do the index refresh.
Sorry, perhaps it is a silly question, but why git index should be different after just touching a file? IOW is it not possible that "git update-index --refresh" exists without modifing the index, just because ther's nothing to modify? So, finally, could be possible making "git status" taking the lock only _after_ has checked there's something new to write to the index? So to avoid write access in most cases ? (expecially with repo mounted on a read-only fs) Thanks Marco - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html