git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 1/3] clone: warn users --depth is ignored in local clones

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Aug 23, 2010, 12:08 UTC
Message-ID
<1282565304-3122-1-git-send-email-pclouds@gmail.com>
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
Next: Nguyễn Thái Ngọc Duy
Message 1 of 11 in “clone: warn users --depth is ignored in local clones”
  1. 1/3 clone: warn users --depth is ignored in local clonesNguyễn Thái Ngọc Duy, Aug 23, 2010
  2. 2/3 fetch-pack: use args.shallow to detect shallow clone instead of args.depthNguyễn Thái Ngọc Duy, Aug 23, 2010
  3. Junio C HamanoAug 24, 2010
  4. Nguyen Thai Ngoc DuyAug 24, 2010
  5. 3/3 {fetch,upload}-pack: allow --depth=0 for infinite depthNguyễn Thái Ngọc Duy, Aug 23, 2010
  6. Jeff KingAug 24, 2010
  7. Junio C HamanoAug 24, 2010
  8. Jeff KingAug 24, 2010
  9. Nguyen Thai Ngoc DuyAug 24, 2010
  10. Jonathan NiederAug 24, 2010
  11. Nguyen Thai Ngoc DuyAug 24, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.