Thread (13 messages) flat view 13 messages, 3 authors, 2016-06-15

Re: Git changes permissions on directories when deleting files.

From: Chad Joan <hidden>
Date: 2016-06-15 22:50:41

On Mon, Feb 28, 2011 at 9:19 PM, Computer Druid [off-list ref] wrote:
On Mon, Feb 28, 2011 at 8:42 PM, Chad Joan [off-list ref] wrote:
quoted
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.
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help