Subject: Re: git clone, hardlinks and multiple users?

From: Marc Herbert <[email-masked]>
Date: Mon, 23 Jan 2012 17:55:37 +0000

On 20/01/2012 17:31, Marc Herbert wrote:
> "git clone" is using hardlinks by default, even when cloning from a
> different user. In such a case the clone ends up with a number of files
> owned by someone else.
>
> Since only immutable objects are cloned this seems to work fine. However
> I would like to know if this "multiple users" case works by chance or by
> specification.

Sorry I meant: "since only immutable objects are HARDLINKED this seems 
to work fine".

A few other clarifications following Neal's long answer:

- Yes we are using Linux. But the question is about any filesystem 
supporting hardlinks and user permissions.

- My question is only about hardlinks in .git/objects/. Whatever happens 
in the checkout is irrelevant.

- I know how to clone with no hardlink and completely avoid the whole 
issue. Unfortunately people have this strange habit of using the 
simplest/default option, and it does hardlinks.

I guess my rephrased question is: while there is no obvious reason for 
git to attempt to touch files in .git/objects/, is there a promise that 
this will never, ever happen? Because it would fail in a multi-users config.

The "core.sharedRepository" option is good example. When set to a new 
value will it ever try to fix existing objects? That would fail.