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, 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
Previous: Computer DruidNext: Chad Joan
Message 4 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.