Re: Git changes permissions on directories when deleting files.
- From
Chad Joan <chadjoan@gmail.com>
- Date
- Mar 1, 2011, 04:00 UTC
- Message-ID
- <AANLkTikFMg_yLWmanqyHveDMR==bw8kxjZgr4mSOmY-2@mail.gmail.com>
- In-Reply-To
- <AANLkTinCjaGMe3TnheqORe7Y_qWYTAr3p6UEsK3u4VyE@mail.gmail.com>
On Mon, Feb 28, 2011 at 9:19 PM, Computer Druid <computerdruid@gmail.com> wrote:
Show 19 quoted lines
> On Mon, Feb 28, 2011 at 8:42 PM, Chad Joan <chadjoan@gmail.com> wrote: >> 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? >
Nope.
Show 21 quoted lines
> 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 >
'somedir' still has plenty of files in it after the deletion, so I'm afraid this isn't the case.
- Chad