Re: Does cloning a shallow repo require special setting in the cloned one?
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Feb 27, 2009, 00:42 UTC
- Message-ID
- <m3prh4vhdg.fsf@localhost.localdomain>
- In-Reply-To
- <6eac7f470902260501v6d826af7rbc5afd1df7b214a3@mail.gmail.com>
Roy Lee <roylee17@gmail.com> writes:
Show 32 quoted lines
> On Thu, Feb 26, 2009 at 6:46 PM, Jeff King <peff@peff.net> wrote:
>> On Thu, Feb 26, 2009 at 08:34:51AM +0200, Teemu Likonen wrote:
>>> On 2009-02-25 19:49 (-0800), roylee17 wrote:
>>>
>>>> $ git clone --depth 1 git-full git-shallow2
>>>> 'git log' still gives a full history
>>>>
>>>> Why can't I clone a shallow repo from the git-full?
>>>> Does it requires some settings in the git-full repo?
>>>
>>> I don't know the "why" part but using file:// URL should work:
>>>
>>> git clone --depth 1 file:///path/to/git-full git-shallow2
>>
>> I don't think the behavior is intentional, but a side effect of the
>> fact that git takes some shortcuts when cloning locally. In particular,
>> it will try to copy or hardlink the object database rather than
>> transmitting over the git protocol locally. Using file:// has always
>> been the way to suppress that shortcut.
>>
>> Perhaps to avoid surprise, that optimization should be turned off for
>> options which cause it to behave differently (like --depth). But I have
>> to wonder what the point of --depth is locally; if you are worried about
>> space, hardlinks (the default) or alternates ("clone -s") are a better
>> solution.
>
> Actully, the original intention was to find a quick way to checkout and
> build several projects regularly. The first thing came to me was cloning
> shallow repos for saving some time. So I tried it with my local repo first.
>
> Later, one of my co-works suggested me to try git archive, and that did
> reallly fit my needs.Perhaps you would be interested then in contrib/workdir/git-new-workdir script then, which allows for multiple checked out copies from a single repository? Be aware that if you work in those copies, and are not careful, it can lead to confusion; but if all but one of checkouts are read only it could be the best solution.
-- Jakub Narebski Poland ShadeHawk on #git