From: Chad Joan Date: Tue, 01 Mar 2011 19:35:41 GMT Subject: Re: Git changes permissions on directories when deleting files. Message-ID: In-Reply-To: On Tue, Mar 1, 2011 at 12:11 PM, Computer Druid wrote: > On Tue, Mar 1, 2011 at 10:51 AM, Chad Joan 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