Re: Git changes permissions on directories when deleting files.
- From
Computer Druid <computerdruid@gmail.com>
- Date
- Mar 1, 2011, 02:19 UTC
- Message-ID
- <AANLkTinCjaGMe3TnheqORe7Y_qWYTAr3p6UEsK3u4VyE@mail.gmail.com>
- In-Reply-To
- <AANLkTikJcOgBAZS=cCWULFYz4U_Mxx1gFMg51+r9qDo0@mail.gmail.com>
On Mon, Feb 28, 2011 at 8:42 PM, Chad Joan <chadjoan@gmail.com> wrote:
Show 15 quoted lines
> Hello, > > What I'm experiencing is this: > > $ cd ~/project > $ ls -dl somedir > drwxrwx--- 1 cjoan cjoan 0 Feb 28 19:57 somedir > $ echo "some text" > somedir/somefile.txt > $ git add somedir/somefile.txt > $ git rm -f somedir/somefile.txt > rm 'somedir/somefile.txt' > $ ls -dl somedir > drw------- 1 cjoan cjoan 0 Feb 28 19:57 somedir > $ echo "some text" > somedir/somefile.txt > bash: somedir/somefile.txt: Permission denied
After you remove the file, is "somedir" empty?
Git doesn't track empty directories, and therefore git rm on the last file in a directory deletes it:
% git init Initialized empty Git repository in /home/cdruid/testrepo/.git/ % mkdir dir % ls -l total 4 drwxr-xr-x 2 cdruid cdruid 4096 Feb 28 21:14 dir % touch dir/test.txt % git add dir/test.txt % git rm -f dir/test.txt rm 'dir/test.txt' % ls -l total 0
My guess is git is somehow failing to delete the directory, thus causing your changed permissions issue.
-Dan Johnson