{"thread":{"id":"24796","subject":"[PATCH 1/3] clone: do not accept --depth on local clones","startedAt":"2010-08-20T01:51:05Z","lastAt":"2010-08-22T22:51:39Z","messageCount":8,"participants":["Nguyễn Thái Ngọc Duy","Jakub Narebski","Junio C Hamano","Nguyen Thai Ngoc Duy"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"148495","messageId":"1282269067-5527-1-git-send-email-pclouds@gmail.com","threadId":"24796","inReplyTo":null,"subject":"[PATCH 1/3] clone: do not accept --depth on local clones","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-08-20T01:51:05Z","receivedAt":"2010-08-20T01:51:05Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"clone_local() function disregards --depth. Make it more apparent.\nAlso hint users that file:// works with --depth.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n builtin/clone.c |    8 ++++++--\n 1 files changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex efb1e6f..e787cf2 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -361,7 +361,7 @@ static void write_remote_refs(const struct ref *local_refs)\n \n int cmd_clone(int argc, const char **argv, const char *prefix)\n {\n-\tint is_bundle = 0;\n+\tint is_bundle = 0, is_local;\n \tstruct stat buf;\n \tconst char *repo_name, *repo, *work_tree, *git_dir;\n \tchar *path, *dir;\n@@ -414,6 +414,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \t\trepo = xstrdup(make_absolute_path(repo_name));\n \telse\n \t\trepo = repo_name;\n+\tis_local = path && !is_bundle;\n+\tif (is_local && option_depth)\n+\t\tdie(\"local clone with --depth does not make sense\\n\"\n+\t\t    \"hint: use file:// instead\");\n \n \tif (argc == 2)\n \t\tdir = xstrdup(argv[1]);\n@@ -514,7 +518,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \n \tstrbuf_reset(&value);\n \n-\tif (path && !is_bundle) {\n+\tif (is_local) {\n \t\trefs = clone_local(path, git_dir);\n \t\tmapped_refs = wanted_peer_refs(refs, refspec);\n \t} else {\n-- \n1.7.1.rc1.69.g24c2f7\n"},{"id":"148496","messageId":"1282269067-5527-2-git-send-email-pclouds@gmail.com","threadId":"24796","inReplyTo":"1282269067-5527-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 2/3] fetch-pack: use args.shallow to detect shallow clone instead of args.depth","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-08-20T01:51:06Z","receivedAt":"2010-08-20T01:51:06Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n builtin/fetch-pack.c |   17 ++++++++++-------\n fetch-pack.h         |    3 ++-\n transport.c          |    9 +++++++--\n transport.h          |    1 +\n 4 files changed, 20 insertions(+), 10 deletions(-)\n\ndiff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c\nindex dbd8b7b..45d1824 100644\n--- a/builtin/fetch-pack.c\n+++ b/builtin/fetch-pack.c\n@@ -167,7 +167,7 @@ enum ack_type {\n \n static void consume_shallow_list(int fd)\n {\n-\tif (args.stateless_rpc && args.depth > 0) {\n+\tif (args.stateless_rpc && args.shallow) {\n \t\t/* If we sent a depth we will get back \"duplicate\"\n \t\t * shallow and unshallow commands every time there\n \t\t * is a block of have lines exchanged.\n@@ -283,12 +283,12 @@ static int find_common(int fd[2], unsigned char *result_sha1,\n \n \tif (is_repository_shallow())\n \t\twrite_shallow_commits(&req_buf, 1);\n-\tif (args.depth > 0)\n+\tif (args.shallow)\n \t\tpacket_buf_write(&req_buf, \"deepen %d\", args.depth);\n \tpacket_buf_flush(&req_buf);\n \tstate_len = req_buf.len;\n \n-\tif (args.depth > 0) {\n+\tif (args.shallow) {\n \t\tchar line[1024];\n \t\tunsigned char sha1[20];\n \n@@ -476,7 +476,7 @@ static void filter_refs(struct ref **refs, int nr_match, char **match)\n \t\t    check_ref_format(ref->name + 5))\n \t\t\t; /* trash */\n \t\telse if (args.fetch_all &&\n-\t\t\t (!args.depth || prefixcmp(ref->name, \"refs/tags/\") )) {\n+\t\t\t (!args.shallow || prefixcmp(ref->name, \"refs/tags/\") )) {\n \t\t\t*newtail = ref;\n \t\t\tref->next = NULL;\n \t\t\tnewtail = &ref->next;\n@@ -534,7 +534,7 @@ static int everything_local(struct ref **refs, int nr_match, char **match)\n \t\t}\n \t}\n \n-\tif (!args.depth) {\n+\tif (!args.shallow) {\n \t\tfor_each_ref(mark_complete, NULL);\n \t\tif (cutoff)\n \t\t\tmark_recent_complete_commits(cutoff);\n@@ -845,6 +845,9 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)\n \t\t\t}\n \t\t\tif (!prefixcmp(arg, \"--depth=\")) {\n \t\t\t\targs.depth = strtol(arg + 8, NULL, 0);\n+\t\t\t\tif (args.depth <= 0)\n+\t\t\t\t\tdie(\"Invalid depth %d\", args.depth);\n+\t\t\t\targs.shallow = 1;\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(\"--no-progress\", arg)) {\n@@ -928,7 +931,7 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,\n \tfetch_pack_setup();\n \tif (&args != my_args)\n \t\tmemcpy(&args, my_args, sizeof(args));\n-\tif (args.depth > 0) {\n+\tif (args.shallow) {\n \t\tif (stat(git_path(\"shallow\"), &st))\n \t\t\tst.st_mtime = 0;\n \t}\n@@ -941,7 +944,7 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,\n \t}\n \tref_cpy = do_fetch_pack(fd, ref, nr_heads, heads, pack_lockfile);\n \n-\tif (args.depth > 0) {\n+\tif (args.shallow) {\n \t\tstruct cache_time mtime;\n \t\tstruct strbuf sb = STRBUF_INIT;\n \t\tchar *shallow = git_path(\"shallow\");\ndiff --git a/fetch-pack.h b/fetch-pack.h\nindex fbe85ac..abc1ab7 100644\n--- a/fetch-pack.h\n+++ b/fetch-pack.h\n@@ -14,7 +14,8 @@ struct fetch_pack_args\n \t\tverbose:1,\n \t\tno_progress:1,\n \t\tinclude_tag:1,\n-\t\tstateless_rpc:1;\n+\t\tstateless_rpc:1,\n+\t\tshallow:1;\n };\n \n struct ref *fetch_pack(struct fetch_pack_args *args,\ndiff --git a/transport.c b/transport.c\nindex 4dba6f8..cf7030b 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -470,10 +470,14 @@ static int set_git_option(struct git_transport_options *opts,\n \t\topts->keep = !!value;\n \t\treturn 0;\n \t} else if (!strcmp(name, TRANS_OPT_DEPTH)) {\n-\t\tif (!value)\n+\t\tif (!value) {\n \t\t\topts->depth = 0;\n-\t\telse\n+\t\t\topts->shallow = 0;\n+\t\t}\n+\t\telse {\n \t\t\topts->depth = atoi(value);\n+\t\t\topts->shallow = 1;\n+\t\t}\n \t\treturn 0;\n \t}\n \treturn 1;\n@@ -529,6 +533,7 @@ static int fetch_refs_via_pack(struct transport *transport,\n \targs.quiet = (transport->verbose < 0);\n \targs.no_progress = !transport->progress;\n \targs.depth = data->options.depth;\n+\targs.shallow = data->options.shallow;\n \n \tfor (i = 0; i < nr_heads; i++)\n \t\torigh[i] = heads[i] = xstrdup(to_fetch[i]->name);\ndiff --git a/transport.h b/transport.h\nindex c59d973..e6ac4b1 100644\n--- a/transport.h\n+++ b/transport.h\n@@ -8,6 +8,7 @@ struct git_transport_options {\n \tunsigned thin : 1;\n \tunsigned keep : 1;\n \tunsigned followtags : 1;\n+\tunsigned shallow : 1;\n \tint depth;\n \tconst char *uploadpack;\n \tconst char *receivepack;\n-- \n1.7.1.rc1.69.g24c2f7\n"},{"id":"148497","messageId":"1282269067-5527-3-git-send-email-pclouds@gmail.com","threadId":"24796","inReplyTo":"1282269067-5527-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 3/3] {fetch,upload}-pack: allow --depth=0 for infinite depth","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-08-20T01:51:07Z","receivedAt":"2010-08-20T01:51:07Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Users can do --depth=2147483648 for infinite depth now. It just looks\nugly. So make \"0\" special (i.e. infinite depth) at plumbing/protocol\nlevel.\n\nTo make it even more user friendly, \"git fetch\" accepts --depth=inf as\nan alternative to --depth=0. \"git clone\" also can. It just does not\nmake much sense for doing \"git clone --depth=inf\"\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Documentation/fetch-options.txt     |    3 ++-\n Documentation/git-fetch-pack.txt    |    1 +\n Documentation/technical/shallow.txt |    2 ++\n builtin/fetch-pack.c                |    2 +-\n shallow.c                           |    2 +-\n t/t5500-fetch-pack.sh               |    8 ++++++++\n transport.c                         |    2 +-\n upload-pack.c                       |    8 ++++----\n 8 files changed, 20 insertions(+), 8 deletions(-)\n\ndiff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt\nindex 9333c42..a22d839 100644\n--- a/Documentation/fetch-options.txt\n+++ b/Documentation/fetch-options.txt\n@@ -10,7 +10,8 @@\n --depth=<depth>::\n \tDeepen the history of a 'shallow' repository created by\n \t`git clone` with `--depth=<depth>` option (see linkgit:git-clone[1])\n-\tby the specified number of commits.\n+\tby the specified number of commits. Specify \"inf\" for\n+\tinfinite depth.\n \n ifndef::git-pull[]\n --dry-run::\ndiff --git a/Documentation/git-fetch-pack.txt b/Documentation/git-fetch-pack.txt\nindex 4a8487c..75e4669 100644\n--- a/Documentation/git-fetch-pack.txt\n+++ b/Documentation/git-fetch-pack.txt\n@@ -70,6 +70,7 @@ OPTIONS\n \n --depth=<n>::\n \tLimit fetching to ancestor-chains not longer than n.\n+\tSpecify 0 for infinite depth.\n \n --no-progress::\n \tDo not show the progress.\ndiff --git a/Documentation/technical/shallow.txt b/Documentation/technical/shallow.txt\nindex 559263a..405170f 100644\n--- a/Documentation/technical/shallow.txt\n+++ b/Documentation/technical/shallow.txt\n@@ -47,3 +47,5 @@ It also writes an appropriate $GIT_DIR/shallow.\n You can deepen a shallow repository with \"git-fetch --depth 20\n repo branch\", which will fetch branch from repo, but stop at depth\n 20, updating $GIT_DIR/shallow.\n+\n+\"--depth 0\" (or \"--depth inf\" for git-fetch) means infinite depth.\ndiff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c\nindex 45d1824..7d7af2e 100644\n--- a/builtin/fetch-pack.c\n+++ b/builtin/fetch-pack.c\n@@ -845,7 +845,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)\n \t\t\t}\n \t\t\tif (!prefixcmp(arg, \"--depth=\")) {\n \t\t\t\targs.depth = strtol(arg + 8, NULL, 0);\n-\t\t\t\tif (args.depth <= 0)\n+\t\t\t\tif (args.depth < 0)\n \t\t\t\t\tdie(\"Invalid depth %d\", args.depth);\n \t\t\t\targs.shallow = 1;\n \t\t\t\tcontinue;\ndiff --git a/shallow.c b/shallow.c\nindex 4d90eda..eab97c6 100644\n--- a/shallow.c\n+++ b/shallow.c\n@@ -85,7 +85,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,\n \t\t\t\t\tcontinue;\n \t\t\t\t*pointer = cur_depth;\n \t\t\t}\n-\t\t\tif (cur_depth < depth) {\n+\t\t\tif (!depth || cur_depth < depth) {\n \t\t\t\tif (p->next)\n \t\t\t\t\tadd_object_array(&p->item->object,\n \t\t\t\t\t\t\tNULL, &stack);\ndiff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh\nindex 18376d6..47fd87c 100755\n--- a/t/t5500-fetch-pack.sh\n+++ b/t/t5500-fetch-pack.sh\n@@ -248,4 +248,12 @@ test_expect_success 'clone shallow object count' '\n \tgrep \"^count: 52\" count.shallow\n '\n \n+test_expect_success 'infinite deepening (full repo)' '\n+\t(\n+\t\tcd shallow &&\n+\t\tgit fetch --depth=inf &&\n+\t\t! test -f .git/shallow\n+\t)\n+'\n+\n test_done\ndiff --git a/transport.c b/transport.c\nindex cf7030b..9303aef 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -475,7 +475,7 @@ static int set_git_option(struct git_transport_options *opts,\n \t\t\topts->shallow = 0;\n \t\t}\n \t\telse {\n-\t\t\topts->depth = atoi(value);\n+\t\t\topts->depth = !strcmp(value, \"inf\") ? 0 : atoi(value);\n \t\t\topts->shallow = 1;\n \t\t}\n \t\treturn 0;\ndiff --git a/upload-pack.c b/upload-pack.c\nindex fc79dde..7b004b9 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -484,7 +484,7 @@ static void receive_needs(void)\n {\n \tstruct object_array shallows = {0, 0, NULL};\n \tstatic char line[1000];\n-\tint len, depth = 0;\n+\tint len, depth = -1;\n \n \tshallow_nr = 0;\n \tif (debug_fd)\n@@ -514,7 +514,7 @@ static void receive_needs(void)\n \t\tif (!prefixcmp(line, \"deepen \")) {\n \t\t\tchar *end;\n \t\t\tdepth = strtol(line + 7, &end, 0);\n-\t\t\tif (end == line + 7 || depth <= 0)\n+\t\t\tif (end == line + 7 || depth < 0)\n \t\t\t\tdie(\"Invalid deepen: %s\", line);\n \t\t\tcontinue;\n \t\t}\n@@ -562,9 +562,9 @@ static void receive_needs(void)\n \tif (!use_sideband && daemon_mode)\n \t\tno_progress = 1;\n \n-\tif (depth == 0 && shallows.nr == 0)\n+\tif (depth == -1 && shallows.nr == 0)\n \t\treturn;\n-\tif (depth > 0) {\n+\tif (depth >= 0) {\n \t\tstruct commit_list *result, *backup;\n \t\tint i;\n \t\tbackup = result = get_shallow_commits(&want_obj, depth,\n-- \n1.7.1.rc1.69.g24c2f7\n"},{"id":"148611","messageId":"201008210011.40236.jnareb@gmail.com","threadId":"24796","inReplyTo":"1282269067-5527-3-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH 3/3] {fetch,upload}-pack: allow --depth=0 for infinite depth","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-08-20T22:11:39Z","receivedAt":"2010-08-20T22:11:39Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Fri, 20 Aug 2010, Nguyễn Thái Ngọc Duy wrote:\n\n> diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt\n> index 9333c42..a22d839 100644\n> --- a/Documentation/fetch-options.txt\n> +++ b/Documentation/fetch-options.txt\n> @@ -10,7 +10,8 @@\n>  --depth=<depth>::\n>  \tDeepen the history of a 'shallow' repository created by\n>  \t`git clone` with `--depth=<depth>` option (see linkgit:git-clone[1])\n> -\tby the specified number of commits.\n> +\tby the specified number of commits. Specify \"inf\" for\n> +\tinfinite depth.\n\nIt should probably be 'Specify 0 or \"inf\" for infinite (unlimited) depth',\nwhich means making repository non-shallow.\n  \n>  ifndef::git-pull[]\n>  --dry-run::\n> diff --git a/Documentation/git-fetch-pack.txt b/Documentation/git-fetch-pack.txt\n> index 4a8487c..75e4669 100644\n> --- a/Documentation/git-fetch-pack.txt\n> +++ b/Documentation/git-fetch-pack.txt\n> @@ -70,6 +70,7 @@ OPTIONS\n>  \n>  --depth=<n>::\n>  \tLimit fetching to ancestor-chains not longer than n.\n> +\tSpecify 0 for infinite depth.\n\nAgain '0 or \"inf\"'.\n  \n>  --no-progress::\n>  \tDo not show the progress.\n> diff --git a/Documentation/technical/shallow.txt b/Documentation/technical/shallow.txt\n> index 559263a..405170f 100644\n> --- a/Documentation/technical/shallow.txt\n> +++ b/Documentation/technical/shallow.txt\n> @@ -47,3 +47,5 @@ It also writes an appropriate $GIT_DIR/shallow.\n>  You can deepen a shallow repository with \"git-fetch --depth 20\n>  repo branch\", which will fetch branch from repo, but stop at depth\n>  20, updating $GIT_DIR/shallow.\n> +\n> +\"--depth 0\" (or \"--depth inf\" for git-fetch) means infinite depth.\n\n???\n\n> diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh\n> index 18376d6..47fd87c 100755\n> --- a/t/t5500-fetch-pack.sh\n> +++ b/t/t5500-fetch-pack.sh\n> @@ -248,4 +248,12 @@ test_expect_success 'clone shallow object count' '\n>  \tgrep \"^count: 52\" count.shallow\n>  '\n>  \n> +test_expect_success 'infinite deepening (full repo)' '\n> +\t(\n> +\t\tcd shallow &&\n> +\t\tgit fetch --depth=inf &&\n> +\t\t! test -f .git/shallow\n> +\t)\n> +'\n> +\n>  test_done\n\nIt's very good that you included test of making repository non-shallow.\n\n-- \nJakub Narebski\nPoland\n"},{"id":"148612","messageId":"7vwrrk95eg.fsf@alter.siamese.dyndns.org","threadId":"24796","inReplyTo":"1282269067-5527-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH 1/3] clone: do not accept --depth on local clones","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-21T00:27:19Z","receivedAt":"2010-08-21T00:27:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:\n\n> clone_local() function disregards --depth. Make it more apparent.\n> Also hint users that file:// works with --depth.\n\nHmm---why?\n\nThe \"--depth\" option is an ugly hack that tries to conserve network\nbandwidth and disk usage, which is not necessary if you are doing a local\nhardlinking clone.  Without this patch we allowed people to clone with the\noption without a downside (allowing it didn't result in broken repository,\nfor example), but with it, what has long been allowed suddenly stops\nworking.  Is the breakage justifiable?\n"},{"id":"148613","messageId":"7vr5hs95e8.fsf@alter.siamese.dyndns.org","threadId":"24796","inReplyTo":"1282269067-5527-3-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH 3/3] {fetch,upload}-pack: allow --depth=0 for infinite depth","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-21T00:27:27Z","receivedAt":"2010-08-21T00:27:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:\n\n> diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt\n> index 9333c42..a22d839 100644\n> --- a/Documentation/fetch-options.txt\n> +++ b/Documentation/fetch-options.txt\n> @@ -10,7 +10,8 @@\n>  --depth=<depth>::\n>  \tDeepen the history of a 'shallow' repository created by\n>  \t`git clone` with `--depth=<depth>` option (see linkgit:git-clone[1])\n> -\tby the specified number of commits.\n> +\tby the specified number of commits. Specify \"inf\" for\n> +\tinfinite depth.\n>  \n>  ifndef::git-pull[]\n>  --dry-run::\n> diff --git a/Documentation/git-fetch-pack.txt b/Documentation/git-fetch-pack.txt\n> index 4a8487c..75e4669 100644\n> --- a/Documentation/git-fetch-pack.txt\n> +++ b/Documentation/git-fetch-pack.txt\n> @@ -70,6 +70,7 @@ OPTIONS\n>  \n>  --depth=<n>::\n>  \tLimit fetching to ancestor-chains not longer than n.\n> +\tSpecify 0 for infinite depth.\n>  \n\nShould we force users to remember which one is which?\n\n> diff --git a/transport.c b/transport.c\n> index cf7030b..9303aef 100644\n> --- a/transport.c\n> +++ b/transport.c\n> @@ -475,7 +475,7 @@ static int set_git_option(struct git_transport_options *opts,\n>  \t\t\topts->shallow = 0;\n>  \t\t}\n>  \t\telse {\n> -\t\t\topts->depth = atoi(value);\n> +\t\t\topts->depth = !strcmp(value, \"inf\") ? 0 : atoi(value);\n\nDoesn't atoi(\"inf\") give you 0 anyway ;-)?\n"},{"id":"148724","messageId":"AANLkTinqO=zB9JKUwYV6wKuRspKKX1j22Y62_6Z1nN7z@mail.gmail.com","threadId":"24796","inReplyTo":"7vwrrk95eg.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/3] clone: do not accept --depth on local clones","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-08-22T22:43:31Z","receivedAt":"2010-08-22T22:43:31Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, Aug 21, 2010 at 10:27 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:\n>\n>> clone_local() function disregards --depth. Make it more apparent.\n>> Also hint users that file:// works with --depth.\n>\n> Hmm---why?\n>\n> The \"--depth\" option is an ugly hack that tries to conserve network\n> bandwidth and disk usage, which is not necessary if you are doing a local\n> hardlinking clone.  Without this patch we allowed people to clone with the\n> option without a downside (allowing it didn't result in broken repository,\n> for example), but with it, what has long been allowed suddenly stops\n> working.  Is the breakage justifiable?\n\nI also expect it to cut down history too. Maybe it's just me, when I\nsay --depth=3, 'git log' should give me more or less 3 commits\nregardless what kind of transport I use to clone. Or we could make it\na warning, \"--depth is ignored in local clone\"?\n-- \nDuy\n"},{"id":"148725","messageId":"AANLkTi=2rYmFutiPU3ZuBbEEivPy4g_1kzzc_QYuMgvN@mail.gmail.com","threadId":"24796","inReplyTo":"201008210011.40236.jnareb@gmail.com","subject":"Re: [PATCH 3/3] {fetch,upload}-pack: allow --depth=0 for infinite depth","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-08-22T22:51:39Z","receivedAt":"2010-08-22T22:51:39Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, Aug 21, 2010 at 8:11 AM, Jakub Narebski <jnareb@gmail.com> wrote:\n> On Fri, 20 Aug 2010, Nguyễn Thái Ngọc Duy wrote:\n>\n>> diff --git a/Documentation/fetch-options.txt\n>> b/Documentation/fetch-options.txt\n>> index 9333c42..a22d839 100644\n>> --- a/Documentation/fetch-options.txt\n>> +++ b/Documentation/fetch-options.txt\n>> @@ -10,7 +10,8 @@\n>>  --depth=<depth>::\n>>       Deepen the history of a 'shallow' repository created by\n>>       `git clone` with `--depth=<depth>` option (see linkgit:git-clone[1])\n>> -     by the specified number of commits.\n>> +     by the specified number of commits. Specify \"inf\" for\n>> +     infinite depth.\n>\n> It should probably be 'Specify 0 or \"inf\" for infinite (unlimited) depth',\n> which means making repository non-shallow.\n\nIt would say \"... which _may_ make the repository non-shallow\". Or I\nhave to redo the patch and make sure tags are fetched automatically\ntoo. Hmm..\n\n>>  ifndef::git-pull[]\n>>  --dry-run::\n>> diff --git a/Documentation/git-fetch-pack.txt\n>> b/Documentation/git-fetch-pack.txt\n>> index 4a8487c..75e4669 100644\n>> --- a/Documentation/git-fetch-pack.txt\n>> +++ b/Documentation/git-fetch-pack.txt\n>> @@ -70,6 +70,7 @@ OPTIONS\n>>\n>>  --depth=<n>::\n>>       Limit fetching to ancestor-chains not longer than n.\n>> +     Specify 0 for infinite depth.\n>\n> Again '0 or \"inf\"'.\n\nOK. \"inf\" was intented for user pleasure, which was the reason I did\nnot implement it in git-fetch-pack (a plumbing). But Jonathan was\nbrave enough to make OPT_INT_INF, I'll rebase this series on that\npatch.\n-- \nDuy\n"}]}