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

Re: 'git status' is not read-only fs friendly

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Feb 9, 2007, 19:56 UTC
Message-ID
<Pine.LNX.4.64.0702091148060.8424@woody.linux-foundation.org>
In-Reply-To
<e5bfff550702091125j202620cfqb2450a3ee69ed421@mail.gmail.com>
On Fri, 9 Feb 2007, Marco Costalba wrote:
Show 10 quoted lines
>
> In a repository under a mounted Windows directory (ntfs) I get this error:
> 
> $ git status
> fatal: unable to create '.git/index.lock': Read-only file system
> $
> 
> Is this correct? there exist a workaround? I just need to know if
> current working directory is clean and report back to qgit user, so
> read-only access would be ok for me.

"git status" is kind of strange. It's really technically the engine behind the messages for "git commit": both in a very real technical sense (it's _literally_ the same script:"git-commit.sh" is not just "git-commit", but also "git-status"), but also in a very real historical "that is what the code was written for".

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).

> All other commands commonly used to browse a repository seems to work
> well, without pretending to write stuff.
"git status" doesn't "pretend" to write stuff. It really does. 

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.

			Linus
Previous: Marco CostalbaNext: Marco Costalba
Message 2 of 52 in “'git status' is not read-only fs friendly”
  1. Marco CostalbaFeb 9, 2007
  2. Linus TorvaldsFeb 9, 2007
  3. Marco CostalbaFeb 9, 2007
  4. Junio C HamanoFeb 9, 2007
  5. Junio C HamanoFeb 9, 2007
  6. Morten WelinderFeb 9, 2007
  7. Theodore TsoFeb 9, 2007
  8. Marco CostalbaFeb 9, 2007
  9. Linus TorvaldsFeb 9, 2007
  10. Junio C HamanoFeb 10, 2007
  11. Junio C HamanoFeb 10, 2007
  12. 1/2 run_diff_{files,index}(): update calling convention.Junio C Hamano, Feb 10, 2007
  13. Marco CostalbaFeb 10, 2007
  14. Junio C HamanoFeb 10, 2007
  15. Marco CostalbaFeb 10, 2007
  16. Marco CostalbaFeb 10, 2007
  17. Junio C HamanoFeb 10, 2007
  18. Marco CostalbaFeb 10, 2007
  19. Junio C HamanoFeb 10, 2007
  20. Marco CostalbaFeb 10, 2007
  21. 2/2 git-runstatus --refreshJunio C Hamano, Feb 10, 2007
  22. Johannes SchindelinFeb 10, 2007
  23. Marco CostalbaFeb 10, 2007
  24. Johannes SchindelinFeb 10, 2007
  25. Marco CostalbaFeb 10, 2007
  26. Marco CostalbaFeb 10, 2007
  27. Junio C HamanoFeb 10, 2007
  28. Johannes SchindelinFeb 10, 2007
  29. Junio C HamanoFeb 11, 2007
  30. Johannes SchindelinFeb 11, 2007
  31. Johannes SchindelinFeb 11, 2007
  32. Junio C HamanoFeb 11, 2007
  33. Johannes SchindelinFeb 11, 2007
  34. Johannes SchindelinFeb 10, 2007
  35. Marco CostalbaFeb 10, 2007
  36. Nicolas PitreFeb 10, 2007
  37. Junio C HamanoFeb 10, 2007
  38. Nicolas PitreFeb 10, 2007
  39. Junio C HamanoFeb 10, 2007
  40. Nicolas PitreFeb 10, 2007
  41. Junio C HamanoFeb 10, 2007
  42. Theodore TsoFeb 10, 2007
  43. Nicolas PitreFeb 10, 2007
  44. Theodore TsoFeb 10, 2007
  45. Marco CostalbaFeb 10, 2007
  46. Linus TorvaldsFeb 10, 2007
  47. Nicolas PitreFeb 10, 2007
  48. Junio C HamanoFeb 11, 2007
  49. Shawn O. PearceFeb 11, 2007
  50. Johannes SchindelinFeb 10, 2007
  51. Junio C HamanoFeb 10, 2007
  52. Marco CostalbaFeb 10, 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.