All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] clone: do not accept --depth on local clones
@ 2010-08-20  1:51 Nguyễn Thái Ngọc Duy
  2010-08-20  1:51 ` [PATCH 2/3] fetch-pack: use args.shallow to detect shallow clone instead of args.depth Nguyễn Thái Ngọc Duy
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2010-08-20  1:51 UTC (permalink / raw)
  To: Jakub Narebski, mikachu, computerdruid, Junio C Hamano, git
  Cc: Nguyễn Thái Ngọc Duy

clone_local() function disregards --depth. Make it more apparent.
Also hint users that file:// works with --depth.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/clone.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/builtin/clone.c b/builtin/clone.c
index efb1e6f..e787cf2 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -361,7 +361,7 @@ static void write_remote_refs(const struct ref *local_refs)
 
 int cmd_clone(int argc, const char **argv, const char *prefix)
 {
-	int is_bundle = 0;
+	int is_bundle = 0, is_local;
 	struct stat buf;
 	const char *repo_name, *repo, *work_tree, *git_dir;
 	char *path, *dir;
@@ -414,6 +414,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 		repo = xstrdup(make_absolute_path(repo_name));
 	else
 		repo = repo_name;
+	is_local = path && !is_bundle;
+	if (is_local && option_depth)
+		die("local clone with --depth does not make sense\n"
+		    "hint: use file:// instead");
 
 	if (argc == 2)
 		dir = xstrdup(argv[1]);
@@ -514,7 +518,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 
 	strbuf_reset(&value);
 
-	if (path && !is_bundle) {
+	if (is_local) {
 		refs = clone_local(path, git_dir);
 		mapped_refs = wanted_peer_refs(refs, refspec);
 	} else {
-- 
1.7.1.rc1.69.g24c2f7

^ permalink raw reply related	[flat|nested] 9+ messages in thread
* Re: fully deepening a shallow clone
@ 2010-08-18 12:54 Daniel Johnson
  2010-08-19 10:40 ` [PATCH 2/3] fetch-pack: use args.shallow to detect shallow clone instead of args.depth Nguyễn Thái Ngọc Duy
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Johnson @ 2010-08-18 12:54 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: Joey Hess, git

[-- Attachment #1: Type: Text/Plain, Size: 1018 bytes --]

On Wednesday 18 August 2010 05:36:08 Nguyen Thai Ngoc Duy wrote:
> On Tue, Aug 17, 2010 at 10:49 AM, Joey Hess <joey@kitenet.net> wrote:
> > git-pull(1):
> >       --depth=<depth>
> >           Deepen the history of a shallow repository created by git clone
> >           with --depth=<depth> option (see git-clone(1)) by the specified
> >           number of commits.
> > 
> > Well, what if I want to deepen an existing shallow clone to include
> > the full history? In practice, something like --depth=100000000 is going
> > to work, but in theory, that will eventually fail some day when there are
> > enough commits. :)
> 
> I have always thought --depth=0 will make full repo again. Have you tried
> that?
I tried it myself. --depth=0 is the same as leaving the depth argument off 
entirely. If you are already working in a shallow clone fetch or pull without 
arguments won't deepen it at all, only pull in new commits.

I haven't been able to figure out a good way to solve this yet though.

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-08-22 22:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-20  1:51 [PATCH 1/3] clone: do not accept --depth on local clones Nguyễn Thái Ngọc Duy
2010-08-20  1:51 ` [PATCH 2/3] fetch-pack: use args.shallow to detect shallow clone instead of args.depth Nguyễn Thái Ngọc Duy
2010-08-20  1:51 ` [PATCH 3/3] {fetch,upload}-pack: allow --depth=0 for infinite depth Nguyễn Thái Ngọc Duy
2010-08-20 22:11   ` Jakub Narebski
2010-08-22 22:51     ` Nguyen Thai Ngoc Duy
2010-08-21  0:27   ` Junio C Hamano
2010-08-21  0:27 ` [PATCH 1/3] clone: do not accept --depth on local clones Junio C Hamano
2010-08-22 22:43   ` Nguyen Thai Ngoc Duy
  -- strict thread matches above, loose matches on Subject: below --
2010-08-18 12:54 fully deepening a shallow clone Daniel Johnson
2010-08-19 10:40 ` [PATCH 2/3] fetch-pack: use args.shallow to detect shallow clone instead of args.depth Nguyễn Thái Ngọc Duy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.