git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: confused about preserved permissions

From
David Kastrup <dak@gnu.org>
Date
Aug 20, 2007, 20:39 UTC
Message-ID
<853ayeos82.fsf@lola.goethe.zz>
In-Reply-To
<20070820184829.GA8617@glandium.org>
Mike Hommey <mh@glandium.org> writes:
Show 22 quoted lines
> On Mon, Aug 20, 2007 at 08:40:13PM +0200, David Kastrup <dak@gnu.org> wrote:
>> Mike Hommey <mh@glandium.org> writes:
>> 
>> > On Mon, Aug 20, 2007 at 07:58:43PM +0200, David Kastrup <dak@gnu.org> wrote:
>> >> > I also never understood why there were no permissions set on
>> >> > directories in trees...
>> >> 
>> >> Because directories are not actually tracked.  They are created and
>> >> deleted as-needed.
>> >
>> > I don't see why it would prevent to have a permission set to
>> > it... the permission technically can be recorded in the parent tree,
>> > along its sha1. Filesystems are also like this.
>> 
>> No, they aren't.  Filesystems don't create and delete directories on
>> the fly.  If we record any information about a directory, deleting it
>> automagically would not be appropriate since we would lose information
>> that has not been explicitly deleted.
>
> git doesn't magically create directories either. It actually stores
> something about them: the hash of the tree object that represents
> them.

The tree object is not a representation of the directory in the file system. It is a hierarchical hash in the repository, stored for efficiency reasons.

> And it has permissions associated with these hashes.

No, with the files. Think again: the link between file system and repository is the index, and the current index format has no representation for trees or directories.

So git _can't_ store any information about a _directory_, since no information about directories passes through the index.

Show 9 quoted lines
> (...)
>> > I think i wasn't clear enough... I just wondered why the format for tree
>> > entries is something like (if you'd write it in perl):
>> > sprintf "%06o %s\0%s", $mode, $file, pack("H[40]", $sha1)
>> 
>> Now I am sure I don't get your point.
>
> See what a raw tree object looks like:
> git-cat-file tree 708453d64796eb617cb8a1602959e00356693315

Well, a tree is a container for files (which in turn consist of their permissions, file names, and blobs).

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Previous: Jan HudecNext: Mike Hommey
Message 33 of 39 in “confused about preserved permissions”
  1. martin f krafftAug 20, 2007
  2. Pierre HabouzitAug 20, 2007
  3. martin f krafftAug 20, 2007
  4. Mike HommeyAug 20, 2007
  5. David KastrupAug 20, 2007
  6. Mike HommeyAug 20, 2007
  7. David KastrupAug 20, 2007
  8. René ScharfeAug 21, 2007
  9. Documentation: update tar.umask defaultRené Scharfe, Aug 21, 2007
  10. Mike HommeyAug 21, 2007
  11. René ScharfeAug 22, 2007
  12. Alex RiesenAug 20, 2007
  13. Benoit SIGOUREAug 22, 2007
  14. Johannes SixtAug 22, 2007
  15. Junio C HamanoAug 22, 2007
  16. martin f krafftAug 23, 2007
  17. David KastrupAug 23, 2007
  18. martin f krafftAug 23, 2007
  19. Benoit SIGOUREAug 23, 2007
  20. Junio C HamanoAug 23, 2007
  21. David KastrupAug 23, 2007
  22. Jan HudecSep 3, 2007
  23. Junio C HamanoAug 23, 2007
  24. Mike HommeyAug 20, 2007
  25. Jan HudecAug 20, 2007
  26. Mike HommeyAug 20, 2007
  27. Alex RiesenAug 20, 2007
  28. Mike HommeyAug 20, 2007
  29. Jan HudecAug 20, 2007
  30. David KastrupAug 20, 2007
  31. Mike HommeyAug 20, 2007
  32. Jan HudecAug 20, 2007
  33. David KastrupAug 20, 2007
  34. Mike HommeyAug 20, 2007
  35. David KastrupAug 20, 2007
  36. Shawn O. PearceAug 21, 2007
  37. Junio C HamanoAug 21, 2007
  38. Mike HommeyAug 21, 2007
  39. David KastrupAug 21, 2007

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.