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

Re: Git changes permissions on directories when deleting files.

From
Chad Joan <chadjoan@gmail.com>
Date
Mar 1, 2011, 19:35 UTC
Message-ID
<AANLkTimBrUo_O6sjhSEf2sPKrYhjMcr24hwRe0kH4CgO@mail.gmail.com>
In-Reply-To
<AANLkTimx7s94wjPasgdY7O9eoyzXXmhWm6f+CB0_2sv3@mail.gmail.com>
On Tue, Mar 1, 2011 at 12:11 PM, Computer Druid <computerdruid@gmail.com> wrote:
Show 11 quoted lines
> On Tue, Mar 1, 2011 at 10:51 AM, Chad Joan <chadjoan@gmail.com> wrote:
>> More info:
>>
>> $ mkdir foo
>> $ mkdir foo/bar
>> $ echo "test" > foo/bar/baz.txt
>> $ echo "somestuff" > foo/bar/somefile.txt
> What happens if you "rmdir foo/bar" here? (while there are files still in it)
>
> -Dan Johnson
>
Something fairly interesting:

$ mkdir foo $ mkdir foo/bar $ ls -dl foo/bar drwxr-x--x 1 cjoan cjoan 0 Mar 1 14:31 foo/bar $ ls -dl foo drwxr-x--x 1 cjoan cjoan 0 Mar 1 14:31 foo $ echo "test" > foo/bar/baz.txt $ echo "somestuff" > foo/bar/somefile.txt $ ls -dl foo/bar drwxr-x--x 1 cjoan cjoan 0 Mar 1 14:31 foo/bar $ ls -dl foo drwxr-x--x 1 cjoan cjoan 0 Mar 1 14:31 foo $ rmdir foo/bar rmdir: failed to remove `foo/bar': Directory not empty $ ls -dl foo/bar drw------- 1 cjoan cjoan 0 Mar 1 14:32 foo/bar $ ls -dl foo drwxr-x--x 1 cjoan cjoan 0 Mar 1 14:31 foo

The rmdir fails of course, but it also changes the permissions. So I take it that git always runs an rmdir on the parent directory when it removes a file? Seems like it would be a sensible way to do it on a system without this behavior.

- Chad
Previous: Computer DruidNext: Jeff King
Message 7 of 19 in “Git changes permissions on directories when deleting files.”
  1. Chad JoanMar 1, 2011
  2. Chad JoanMar 1, 2011
  3. Computer DruidMar 1, 2011
  4. Chad JoanMar 1, 2011
  5. Chad JoanMar 1, 2011
  6. Computer DruidMar 1, 2011
  7. Chad JoanMar 1, 2011
  8. Jeff KingMar 1, 2011
  9. Chad JoanMar 1, 2011
  10. Jeff KingMar 1, 2011
  11. Chad JoanMar 1, 2011
  12. Computer DruidMar 1, 2011
  13. Jeff KingMar 1, 2011
  14. Matthieu MoyMar 1, 2011
  15. Chad JoanMar 1, 2011
  16. Jeff KingMar 1, 2011
  17. Chad JoanMar 3, 2011
  18. Jeff KingMar 3, 2011
  19. Chad JoanMar 11, 2011

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.