git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH v2 1/3] clone: warn users --depth is ignored in local clones
@ 2010-08-23 12:08 Nguyễn Thái Ngọc Duy
  2010-08-23 12:08 ` [PATCH v2 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; 11+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2010-08-23 12:08 UTC (permalink / raw)
  To: Junio C Hamano, git; +Cc: Nguyễn Thái Ngọc Duy


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Just warn users instead of dying in the old patch.

 builtin/clone.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/builtin/clone.c b/builtin/clone.c
index efb1e6f..fcdb039 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,9 @@ 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)
+		warning("--depth is ignored in local clones, use file:// instead.");
 
 	if (argc == 2)
 		dir = xstrdup(argv[1]);
@@ -514,7 +517,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] 11+ messages in thread

* [PATCH v2 2/3] fetch-pack: use args.shallow to detect shallow clone instead of args.depth
  2010-08-23 12:08 [PATCH v2 1/3] clone: warn users --depth is ignored in local clones Nguyễn Thái Ngọc Duy
@ 2010-08-23 12:08 ` Nguyễn Thái Ngọc Duy
  2010-08-24 16:31   ` Junio C Hamano
  2010-08-23 12:08 ` [PATCH v2 3/3] {fetch,upload}-pack: allow --depth=0 for infinite depth Nguyễn Thái Ngọc Duy
  2010-08-24  5:28 ` [PATCH v2 1/3] clone: warn users --depth is ignored in local clones Jonathan Nieder
  2 siblings, 1 reply; 11+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2010-08-23 12:08 UTC (permalink / raw)
  To: Junio C Hamano, git; +Cc: Nguyễn Thái Ngọc Duy


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/fetch-pack.c |   17 ++++++++++-------
 fetch-pack.h         |    3 ++-
 transport.c          |    9 +++++++--
 transport.h          |    1 +
 4 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index dbd8b7b..45d1824 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -167,7 +167,7 @@ enum ack_type {
 
 static void consume_shallow_list(int fd)
 {
-	if (args.stateless_rpc && args.depth > 0) {
+	if (args.stateless_rpc && args.shallow) {
 		/* If we sent a depth we will get back "duplicate"
 		 * shallow and unshallow commands every time there
 		 * is a block of have lines exchanged.
@@ -283,12 +283,12 @@ static int find_common(int fd[2], unsigned char *result_sha1,
 
 	if (is_repository_shallow())
 		write_shallow_commits(&req_buf, 1);
-	if (args.depth > 0)
+	if (args.shallow)
 		packet_buf_write(&req_buf, "deepen %d", args.depth);
 	packet_buf_flush(&req_buf);
 	state_len = req_buf.len;
 
-	if (args.depth > 0) {
+	if (args.shallow) {
 		char line[1024];
 		unsigned char sha1[20];
 
@@ -476,7 +476,7 @@ static void filter_refs(struct ref **refs, int nr_match, char **match)
 		    check_ref_format(ref->name + 5))
 			; /* trash */
 		else if (args.fetch_all &&
-			 (!args.depth || prefixcmp(ref->name, "refs/tags/") )) {
+			 (!args.shallow || prefixcmp(ref->name, "refs/tags/") )) {
 			*newtail = ref;
 			ref->next = NULL;
 			newtail = &ref->next;
@@ -534,7 +534,7 @@ static int everything_local(struct ref **refs, int nr_match, char **match)
 		}
 	}
 
-	if (!args.depth) {
+	if (!args.shallow) {
 		for_each_ref(mark_complete, NULL);
 		if (cutoff)
 			mark_recent_complete_commits(cutoff);
@@ -845,6 +845,9 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
 			}
 			if (!prefixcmp(arg, "--depth=")) {
 				args.depth = strtol(arg + 8, NULL, 0);
+				if (args.depth <= 0)
+					die("Invalid depth %d", args.depth);
+				args.shallow = 1;
 				continue;
 			}
 			if (!strcmp("--no-progress", arg)) {
@@ -928,7 +931,7 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
 	fetch_pack_setup();
 	if (&args != my_args)
 		memcpy(&args, my_args, sizeof(args));
-	if (args.depth > 0) {
+	if (args.shallow) {
 		if (stat(git_path("shallow"), &st))
 			st.st_mtime = 0;
 	}
@@ -941,7 +944,7 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
 	}
 	ref_cpy = do_fetch_pack(fd, ref, nr_heads, heads, pack_lockfile);
 
-	if (args.depth > 0) {
+	if (args.shallow) {
 		struct cache_time mtime;
 		struct strbuf sb = STRBUF_INIT;
 		char *shallow = git_path("shallow");
diff --git a/fetch-pack.h b/fetch-pack.h
index fbe85ac..abc1ab7 100644
--- a/fetch-pack.h
+++ b/fetch-pack.h
@@ -14,7 +14,8 @@ struct fetch_pack_args
 		verbose:1,
 		no_progress:1,
 		include_tag:1,
-		stateless_rpc:1;
+		stateless_rpc:1,
+		shallow:1;
 };
 
 struct ref *fetch_pack(struct fetch_pack_args *args,
diff --git a/transport.c b/transport.c
index 4dba6f8..cf7030b 100644
--- a/transport.c
+++ b/transport.c
@@ -470,10 +470,14 @@ static int set_git_option(struct git_transport_options *opts,
 		opts->keep = !!value;
 		return 0;
 	} else if (!strcmp(name, TRANS_OPT_DEPTH)) {
-		if (!value)
+		if (!value) {
 			opts->depth = 0;
-		else
+			opts->shallow = 0;
+		}
+		else {
 			opts->depth = atoi(value);
+			opts->shallow = 1;
+		}
 		return 0;
 	}
 	return 1;
@@ -529,6 +533,7 @@ static int fetch_refs_via_pack(struct transport *transport,
 	args.quiet = (transport->verbose < 0);
 	args.no_progress = !transport->progress;
 	args.depth = data->options.depth;
+	args.shallow = data->options.shallow;
 
 	for (i = 0; i < nr_heads; i++)
 		origh[i] = heads[i] = xstrdup(to_fetch[i]->name);
diff --git a/transport.h b/transport.h
index c59d973..e6ac4b1 100644
--- a/transport.h
+++ b/transport.h
@@ -8,6 +8,7 @@ struct git_transport_options {
 	unsigned thin : 1;
 	unsigned keep : 1;
 	unsigned followtags : 1;
+	unsigned shallow : 1;
 	int depth;
 	const char *uploadpack;
 	const char *receivepack;
-- 
1.7.1.rc1.69.g24c2f7

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

* [PATCH v2 3/3] {fetch,upload}-pack: allow --depth=0 for infinite depth
  2010-08-23 12:08 [PATCH v2 1/3] clone: warn users --depth is ignored in local clones Nguyễn Thái Ngọc Duy
  2010-08-23 12:08 ` [PATCH v2 2/3] fetch-pack: use args.shallow to detect shallow clone instead of args.depth Nguyễn Thái Ngọc Duy
@ 2010-08-23 12:08 ` Nguyễn Thái Ngọc Duy
  2010-08-24 13:53   ` Jeff King
  2010-08-24  5:28 ` [PATCH v2 1/3] clone: warn users --depth is ignored in local clones Jonathan Nieder
  2 siblings, 1 reply; 11+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2010-08-23 12:08 UTC (permalink / raw)
  To: Junio C Hamano, git; +Cc: Nguyễn Thái Ngọc Duy

Users can do --depth=2147483648 for infinite depth now. It just looks
ugly. So make "0" special (i.e. infinite depth) at plumbing/protocol
level.

To make it even more user friendly, "git fetch" accepts --depth=inf as
an alternative to --depth=0. "git clone" also can. It just does not
make much sense for doing "git clone --depth=inf"

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Neither fetch-pack nor fetch uses parseopt, so Jonathan's OPT_INT_INF
 has no use here (yet).

 Documents updated.

 Documentation/fetch-options.txt     |    5 ++++-
 Documentation/git-fetch-pack.txt    |    1 +
 Documentation/technical/shallow.txt |    2 ++
 builtin/fetch-pack.c                |    4 ++--
 shallow.c                           |    2 +-
 t/t5500-fetch-pack.sh               |    8 ++++++++
 upload-pack.c                       |    8 ++++----
 7 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt
index 9333c42..0368afd 100644
--- a/Documentation/fetch-options.txt
+++ b/Documentation/fetch-options.txt
@@ -10,7 +10,10 @@
 --depth=<depth>::
 	Deepen the history of a 'shallow' repository created by
 	`git clone` with `--depth=<depth>` option (see linkgit:git-clone[1])
-	by the specified number of commits.
+	by the specified number of commits. Specify 0 or "inf"
+	for infinite depth, which may turn repository to a
+	non-shallow one again (you may need --tags so that all
+	commit chains are fully fetched).
 
 ifndef::git-pull[]
 --dry-run::
diff --git a/Documentation/git-fetch-pack.txt b/Documentation/git-fetch-pack.txt
index 4a8487c..ce15196 100644
--- a/Documentation/git-fetch-pack.txt
+++ b/Documentation/git-fetch-pack.txt
@@ -70,6 +70,7 @@ OPTIONS
 
 --depth=<n>::
 	Limit fetching to ancestor-chains not longer than n.
+	Specify 0 or "inf" for infinite depth.
 
 --no-progress::
 	Do not show the progress.
diff --git a/Documentation/technical/shallow.txt b/Documentation/technical/shallow.txt
index 559263a..eeca540 100644
--- a/Documentation/technical/shallow.txt
+++ b/Documentation/technical/shallow.txt
@@ -47,3 +47,5 @@ It also writes an appropriate $GIT_DIR/shallow.
 You can deepen a shallow repository with "git-fetch --depth 20
 repo branch", which will fetch branch from repo, but stop at depth
 20, updating $GIT_DIR/shallow.
+
+Depth 0 means infinite depth.
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index 45d1824..df30381 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -844,8 +844,8 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
 				continue;
 			}
 			if (!prefixcmp(arg, "--depth=")) {
-				args.depth = strtol(arg + 8, NULL, 0);
-				if (args.depth <= 0)
+				args.depth = !strcmp(arg + 8, "inf") ? 0 : strtol(arg + 8, NULL, 0);
+				if (args.depth < 0)
 					die("Invalid depth %d", args.depth);
 				args.shallow = 1;
 				continue;
diff --git a/shallow.c b/shallow.c
index 4d90eda..eab97c6 100644
--- a/shallow.c
+++ b/shallow.c
@@ -85,7 +85,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
 					continue;
 				*pointer = cur_depth;
 			}
-			if (cur_depth < depth) {
+			if (!depth || cur_depth < depth) {
 				if (p->next)
 					add_object_array(&p->item->object,
 							NULL, &stack);
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 18376d6..47fd87c 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -248,4 +248,12 @@ test_expect_success 'clone shallow object count' '
 	grep "^count: 52" count.shallow
 '
 
+test_expect_success 'infinite deepening (full repo)' '
+	(
+		cd shallow &&
+		git fetch --depth=inf &&
+		! test -f .git/shallow
+	)
+'
+
 test_done
diff --git a/upload-pack.c b/upload-pack.c
index fc79dde..7b004b9 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -484,7 +484,7 @@ static void receive_needs(void)
 {
 	struct object_array shallows = {0, 0, NULL};
 	static char line[1000];
-	int len, depth = 0;
+	int len, depth = -1;
 
 	shallow_nr = 0;
 	if (debug_fd)
@@ -514,7 +514,7 @@ static void receive_needs(void)
 		if (!prefixcmp(line, "deepen ")) {
 			char *end;
 			depth = strtol(line + 7, &end, 0);
-			if (end == line + 7 || depth <= 0)
+			if (end == line + 7 || depth < 0)
 				die("Invalid deepen: %s", line);
 			continue;
 		}
@@ -562,9 +562,9 @@ static void receive_needs(void)
 	if (!use_sideband && daemon_mode)
 		no_progress = 1;
 
-	if (depth == 0 && shallows.nr == 0)
+	if (depth == -1 && shallows.nr == 0)
 		return;
-	if (depth > 0) {
+	if (depth >= 0) {
 		struct commit_list *result, *backup;
 		int i;
 		backup = result = get_shallow_commits(&want_obj, depth,
-- 
1.7.1.rc1.69.g24c2f7

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

* Re: [PATCH v2 1/3] clone: warn users --depth is ignored in local clones
  2010-08-23 12:08 [PATCH v2 1/3] clone: warn users --depth is ignored in local clones Nguyễn Thái Ngọc Duy
  2010-08-23 12:08 ` [PATCH v2 2/3] fetch-pack: use args.shallow to detect shallow clone instead of args.depth Nguyễn Thái Ngọc Duy
  2010-08-23 12:08 ` [PATCH v2 3/3] {fetch,upload}-pack: allow --depth=0 for infinite depth Nguyễn Thái Ngọc Duy
@ 2010-08-24  5:28 ` Jonathan Nieder
  2010-08-24  5:52   ` Nguyen Thai Ngoc Duy
  2 siblings, 1 reply; 11+ messages in thread
From: Jonathan Nieder @ 2010-08-24  5:28 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: Junio C Hamano, git

Nguyễn Thái Ngọc Duy wrote:

> +++ 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,9 @@ 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)
> +		warning("--depth is ignored in local clones, use file:// instead.");

Micronit: this comma should be a semicolon or period.

As for the patch itself: I like it.  I could have used this advice
about a year ago.

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

* Re: [PATCH v2 1/3] clone: warn users --depth is ignored in local clones
  2010-08-24  5:28 ` [PATCH v2 1/3] clone: warn users --depth is ignored in local clones Jonathan Nieder
@ 2010-08-24  5:52   ` Nguyen Thai Ngoc Duy
  0 siblings, 0 replies; 11+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2010-08-24  5:52 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Junio C Hamano, git

On Tue, Aug 24, 2010 at 3:28 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Nguyễn Thái Ngọc Duy wrote:
>
>> +++ 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,9 @@ 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)
>> +             warning("--depth is ignored in local clones, use file://
>> instead.");
>
> Micronit: this comma should be a semicolon or period.

I'd leave it for Junio to edit the patch if he likes it.
-- 
Duy

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

* Re: [PATCH v2 3/3] {fetch,upload}-pack: allow --depth=0 for infinite depth
  2010-08-23 12:08 ` [PATCH v2 3/3] {fetch,upload}-pack: allow --depth=0 for infinite depth Nguyễn Thái Ngọc Duy
@ 2010-08-24 13:53   ` Jeff King
  2010-08-24 17:39     ` Junio C Hamano
  2010-08-24 22:12     ` Nguyen Thai Ngoc Duy
  0 siblings, 2 replies; 11+ messages in thread
From: Jeff King @ 2010-08-24 13:53 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: Junio C Hamano, git

On Mon, Aug 23, 2010 at 10:08:24PM +1000, Nguyễn Thái Ngọc Duy wrote:

> Users can do --depth=2147483648 for infinite depth now. It just looks
> ugly. So make "0" special (i.e. infinite depth) at plumbing/protocol
> level.

What happens if I connect to an older server? Shouldn't "I understand
depth=0 is infinite" be a server capability, and we hack around it by
sending depth=2^32-1 when we have a modern client but an older server?

-Peff

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

* Re: [PATCH v2 2/3] fetch-pack: use args.shallow to detect shallow clone instead of args.depth
  2010-08-23 12:08 ` [PATCH v2 2/3] fetch-pack: use args.shallow to detect shallow clone instead of args.depth Nguyễn Thái Ngọc Duy
@ 2010-08-24 16:31   ` Junio C Hamano
  2010-08-24 22:14     ` Nguyen Thai Ngoc Duy
  0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2010-08-24 16:31 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: Junio C Hamano, git

Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:

> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---

Isn't there any rationale for this change?  "args.depth > 0 does not
necessarily mean we are in a shallow clone situation, because ..." or
"using args.depth > 0 to check if we are in a shallow clone breaks under
such and such conditions and here is a test case to reproduce the bug"?

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

* Re: [PATCH v2 3/3] {fetch,upload}-pack: allow --depth=0 for infinite depth
  2010-08-24 13:53   ` Jeff King
@ 2010-08-24 17:39     ` Junio C Hamano
  2010-08-24 17:46       ` Jeff King
  2010-08-24 22:12     ` Nguyen Thai Ngoc Duy
  1 sibling, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2010-08-24 17:39 UTC (permalink / raw)
  To: Jeff King; +Cc: Nguyễn Thái Ngọc Duy, git

Jeff King <peff@peff.net> writes:

> On Mon, Aug 23, 2010 at 10:08:24PM +1000, Nguyễn Thái Ngọc Duy wrote:
>
>> Users can do --depth=2147483648 for infinite depth now. It just looks
>> ugly. So make "0" special (i.e. infinite depth) at plumbing/protocol
>> level.
>
> What happens if I connect to an older server? Shouldn't "I understand
> depth=0 is infinite" be a server capability, and we hack around it by
> sending depth=2^32-1 when we have a modern client but an older server?

Good point.  Do we also need to find out how wide an int is on the other
end in that case?

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

* Re: [PATCH v2 3/3] {fetch,upload}-pack: allow --depth=0 for infinite depth
  2010-08-24 17:39     ` Junio C Hamano
@ 2010-08-24 17:46       ` Jeff King
  0 siblings, 0 replies; 11+ messages in thread
From: Jeff King @ 2010-08-24 17:46 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Nguyễn Thái Ngọc Duy, git

On Tue, Aug 24, 2010 at 10:39:46AM -0700, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
> > On Mon, Aug 23, 2010 at 10:08:24PM +1000, Nguyễn Thái Ngọc Duy wrote:
> >
> >> Users can do --depth=2147483648 for infinite depth now. It just looks
> >> ugly. So make "0" special (i.e. infinite depth) at plumbing/protocol
> >> level.
> >
> > What happens if I connect to an older server? Shouldn't "I understand
> > depth=0 is infinite" be a server capability, and we hack around it by
> > sending depth=2^32-1 when we have a modern client but an older server?
> 
> Good point.  Do we also need to find out how wide an int is on the other
> end in that case?

I doubt it. We can probably assume that the remote can handle a signed
32-bit depth (so really, my example should have been 2^31-1). If they
can't, then it would probably be at best an unsigned 16-bit int, in
which case we could only handle a depth of 65535 commits. There are way
more than that in common repositories, so --depth with such an
implementation would be pretty broken already.

-Peff

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

* Re: [PATCH v2 3/3] {fetch,upload}-pack: allow --depth=0 for infinite depth
  2010-08-24 13:53   ` Jeff King
  2010-08-24 17:39     ` Junio C Hamano
@ 2010-08-24 22:12     ` Nguyen Thai Ngoc Duy
  1 sibling, 0 replies; 11+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2010-08-24 22:12 UTC (permalink / raw)
  To: Jeff King; +Cc: Junio C Hamano, git

On Tue, Aug 24, 2010 at 11:53 PM, Jeff King <peff@peff.net> wrote:
> On Mon, Aug 23, 2010 at 10:08:24PM +1000, Nguyễn Thái Ngọc Duy wrote:
>
>> Users can do --depth=2147483648 for infinite depth now. It just looks
>> ugly. So make "0" special (i.e. infinite depth) at plumbing/protocol
>> level.
>
> What happens if I connect to an older server? Shouldn't "I understand
> depth=0 is infinite" be a server capability, and we hack around it by
> sending depth=2^32-1 when we have a modern client but an older server?

Older servers won't accept depth=0, dying with "Invalid deepen"
message. I don't really want to send a large number as a workaround,
it just does not feel safe. Users can either play around with
--depth=2^32-1, or upgrade servers.

And in case of modern server and old client, old fetch-pack would
never send "deepen 0", so it's safe too, at least for current
fetch-pack.
-- 
Duy

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

* Re: [PATCH v2 2/3] fetch-pack: use args.shallow to detect shallow clone instead of args.depth
  2010-08-24 16:31   ` Junio C Hamano
@ 2010-08-24 22:14     ` Nguyen Thai Ngoc Duy
  0 siblings, 0 replies; 11+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2010-08-24 22:14 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Wed, Aug 25, 2010 at 2:31 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>
>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
>> ---
>
> Isn't there any rationale for this change?  "args.depth > 0 does not
> necessarily mean we are in a shallow clone situation, because ..." or
> "using args.depth > 0 to check if we are in a shallow clone breaks under
> such and such conditions and here is a test case to reproduce the bug"?

.. because args.depth=0 is now also a shallow clone situation, i.e. a
valid depth too.
-- 
Duy

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

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

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-23 12:08 [PATCH v2 1/3] clone: warn users --depth is ignored in local clones Nguyễn Thái Ngọc Duy
2010-08-23 12:08 ` [PATCH v2 2/3] fetch-pack: use args.shallow to detect shallow clone instead of args.depth Nguyễn Thái Ngọc Duy
2010-08-24 16:31   ` Junio C Hamano
2010-08-24 22:14     ` Nguyen Thai Ngoc Duy
2010-08-23 12:08 ` [PATCH v2 3/3] {fetch,upload}-pack: allow --depth=0 for infinite depth Nguyễn Thái Ngọc Duy
2010-08-24 13:53   ` Jeff King
2010-08-24 17:39     ` Junio C Hamano
2010-08-24 17:46       ` Jeff King
2010-08-24 22:12     ` Nguyen Thai Ngoc Duy
2010-08-24  5:28 ` [PATCH v2 1/3] clone: warn users --depth is ignored in local clones Jonathan Nieder
2010-08-24  5:52   ` Nguyen Thai Ngoc Duy

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).