* Does cloning a shallow repo require special setting in the cloned one?
@ 2009-02-26 3:49 roylee17
2009-02-26 6:34 ` Teemu Likonen
0 siblings, 1 reply; 8+ messages in thread
From: roylee17 @ 2009-02-26 3:49 UTC (permalink / raw)
To: git
Hi,
I have a question about cloning shallow repo.
$ git clone --depth 1 git://git2.kernel.org/pub/scm/git/git.git git-shallow
ok, 'git log' gives a 2-revision history.
$ git clone git://git2.kernel.org/pub/scm/git/git.git git-full
'git log' gives a full history
$ 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?
Regards,
Roy
Roy
--
View this message in context: http://n2.nabble.com/Does-cloning-a-shallow-repo-require-special-setting-in-the-cloned-one--tp2387799p2387799.html
Sent from the git mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Does cloning a shallow repo require special setting in the cloned one?
2009-02-26 3:49 Does cloning a shallow repo require special setting in the cloned one? roylee17
@ 2009-02-26 6:34 ` Teemu Likonen
2009-02-26 7:33 ` Roy Lee
2009-02-26 10:46 ` Jeff King
0 siblings, 2 replies; 8+ messages in thread
From: Teemu Likonen @ 2009-02-26 6:34 UTC (permalink / raw)
To: roylee17; +Cc: git
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Does cloning a shallow repo require special setting in the cloned one?
2009-02-26 6:34 ` Teemu Likonen
@ 2009-02-26 7:33 ` Roy Lee
2009-02-26 10:46 ` Jeff King
1 sibling, 0 replies; 8+ messages in thread
From: Roy Lee @ 2009-02-26 7:33 UTC (permalink / raw)
To: Teemu Likonen; +Cc: git
On Thu, Feb 26, 2009 at 2:34 PM, Teemu Likonen <tlikonen@iki.fi> 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
>
Thanks, Teemu. file:///path/to/git-full works.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Does cloning a shallow repo require special setting in the cloned one?
2009-02-26 6:34 ` Teemu Likonen
2009-02-26 7:33 ` Roy Lee
@ 2009-02-26 10:46 ` Jeff King
2009-02-26 11:17 ` Johannes Schindelin
2009-02-26 13:01 ` Roy Lee
1 sibling, 2 replies; 8+ messages in thread
From: Jeff King @ 2009-02-26 10:46 UTC (permalink / raw)
To: Teemu Likonen; +Cc: roylee17, git
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.
-Peff
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Does cloning a shallow repo require special setting in the cloned one?
2009-02-26 10:46 ` Jeff King
@ 2009-02-26 11:17 ` Johannes Schindelin
2009-02-26 13:19 ` Jeff King
2009-02-26 13:01 ` Roy Lee
1 sibling, 1 reply; 8+ messages in thread
From: Johannes Schindelin @ 2009-02-26 11:17 UTC (permalink / raw)
To: Jeff King; +Cc: Teemu Likonen, roylee17, git
Hi,
On Thu, 26 Feb 2009, Jeff King 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.
I think it is way better to warn, since "--depth" is usually passed out of
concerns about disk space. And --shared should shut that concern up
rather nicely.
diff --git a/builtin-clone.c b/builtin-clone.c
index c338910..5831034 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -511,8 +511,11 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
refspec.src = src_ref_prefix;
refspec.dst = branch_top.buf;
- if (path && !is_bundle)
+ if (path && !is_bundle) {
+ if (option_depth)
+ warning("Ignoring --depth for local clone");
refs = clone_local(path, git_dir);
+ }
else {
struct remote *remote = remote_get(argv[0]);
transport = transport_get(remote, remote->url[0]);
Lacks tests,
Dscho
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: Does cloning a shallow repo require special setting in the cloned one?
2009-02-26 10:46 ` Jeff King
2009-02-26 11:17 ` Johannes Schindelin
@ 2009-02-26 13:01 ` Roy Lee
2009-02-27 0:42 ` Jakub Narebski
1 sibling, 1 reply; 8+ messages in thread
From: Roy Lee @ 2009-02-26 13:01 UTC (permalink / raw)
To: Jeff King; +Cc: Teemu Likonen, git
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.
>
> -Peff
>
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.
Thanks for clarifying my confusion.
Roy
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Does cloning a shallow repo require special setting in the cloned one?
2009-02-26 11:17 ` Johannes Schindelin
@ 2009-02-26 13:19 ` Jeff King
0 siblings, 0 replies; 8+ messages in thread
From: Jeff King @ 2009-02-26 13:19 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Teemu Likonen, roylee17, git
On Thu, Feb 26, 2009 at 12:17:36PM +0100, Johannes Schindelin wrote:
> I think it is way better to warn, since "--depth" is usually passed out of
> concerns about disk space. And --shared should shut that concern up
> rather nicely.
>
> diff --git a/builtin-clone.c b/builtin-clone.c
> index c338910..5831034 100644
> --- a/builtin-clone.c
> +++ b/builtin-clone.c
> @@ -511,8 +511,11 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
> refspec.src = src_ref_prefix;
> refspec.dst = branch_top.buf;
>
> - if (path && !is_bundle)
> + if (path && !is_bundle) {
> + if (option_depth)
> + warning("Ignoring --depth for local clone");
> refs = clone_local(path, git_dir);
> + }
> else {
> struct remote *remote = remote_get(argv[0]);
> transport = transport_get(remote, remote->url[0]);
That seems reasonable to me.
-Peff
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Does cloning a shallow repo require special setting in the cloned one?
2009-02-26 13:01 ` Roy Lee
@ 2009-02-27 0:42 ` Jakub Narebski
0 siblings, 0 replies; 8+ messages in thread
From: Jakub Narebski @ 2009-02-27 0:42 UTC (permalink / raw)
To: Roy Lee; +Cc: Jeff King, Teemu Likonen, git
Roy Lee <roylee17@gmail.com> writes:
> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-02-27 0:43 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-26 3:49 Does cloning a shallow repo require special setting in the cloned one? roylee17
2009-02-26 6:34 ` Teemu Likonen
2009-02-26 7:33 ` Roy Lee
2009-02-26 10:46 ` Jeff King
2009-02-26 11:17 ` Johannes Schindelin
2009-02-26 13:19 ` Jeff King
2009-02-26 13:01 ` Roy Lee
2009-02-27 0:42 ` Jakub Narebski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).