Subject: Re: confused about preserved permissions

From: Mike Hommey <[email-masked]>
Date: Mon, 20 Aug 2007 20:13:57 +0200

On Mon, Aug 20, 2007 at 07:58:43PM +0200, David Kastrup <[email-masked]> 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.

> In my proposal for allowing directories to get tracked, permissions of
> 000 would indicate a tree without a corresponding tracked directory.
> Other permissions would correspond to a tracked directory.  I am still
> stuck over the representation in the index.
> 
> One idea is to unconditionally have an entry "dirname" without
> permissions, and optionally "dirname/" with permissions iff the
> directory is supposed to be tracked, both to be sorted in
> alphabetically.  The idea of the first entry is being able to detect
> merge conflicts without extra passes.
> 
> But I have not worked on the stuff for a while.

I don't see why you would need an additional entry for the directory
permission.

> > nor why, while the sha1 for child objects are "packed", the modes
> > aren't...
> 
> Because a change of the mode of a file will then not cause different
> sha1 sums at the file level.

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)

Mike