Thread (6 messages) flat view 6 messages, 3 authors, 2016-06-15

Re: [PATCH 1/2] clone: do not ignore --no-hardlinks

From: Jeff King <hidden>
Date: 2016-06-15 22:46:17
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

On Fri, Feb 27, 2009 at 12:31:22AM +0100, Johannes Schindelin wrote:
Somehow --no-hardlinks got broken by making clone a builtin.  This
was discovered during my work on --depth being ignored for local
clones.

There will be a test case that tests for --no-hardlinks in conjunction
with --depth, so this patch is not accompanied by a separate test.
Hmm. But --no-hardlinks has an effect later, in copy_or_link_directory,
making it just do a copy. So it _does_ work, just not in the way you
expect.

I think to turn off local shortcuts entirely, --no-local would probably
make more sense. IOW, something like this:

---
diff --git a/builtin-clone.c b/builtin-clone.c
index c338910..7c6f59f 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -35,7 +35,8 @@ static const char * const builtin_clone_usage[] = {
 };
 
 static int option_quiet, option_no_checkout, option_bare, option_mirror;
-static int option_local, option_no_hardlinks, option_shared;
+static int option_local = -1;
+static int option_no_hardlinks, option_shared;
 static char *option_template, *option_reference, *option_depth;
 static char *option_origin = NULL;
 static char *option_upload_pack = "git-upload-pack";
@@ -229,7 +230,7 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest)
 		if (!option_no_hardlinks) {
 			if (!link(src->buf, dest->buf))
 				continue;
-			if (option_local)
+			if (option_local == 1)
 				die("failed to create link %s", dest->buf);
 			option_no_hardlinks = 1;
 		}
@@ -511,7 +512,7 @@ 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 (option_local != 0 && path && !is_bundle)
 		refs = clone_local(path, git_dir);
 	else {
 		struct remote *remote = remote_get(argv[0]);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help