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

Re: [PATCH 0/2] clone-local fixup

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 23, 2011, 16:26 UTC
Message-ID
<7vzkj0rt57.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4E5321C9.4080301@gmail.com>
Hui Wang <jason77.wang@gmail.com> writes:
Show 5 quoted lines
> This patch series solved the problem from the root cause. :-)
>
> But there is a little problem in the second patch, i provide an
> incremental patch basing on your second patch, if it is fine to you,
> it is OK to squash this patch to your second patch.

Thanks. We also need the following fix-up, as I changed the semantics of add_to_alternates_file() to take the path to the "objects" directory.

diff --git a/builtin/clone.c b/builtin/clone.c
index 284e325..63c34d0 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -336,14 +336,17 @@ static const struct ref *clone_local(const char *src_repo,
 				     const char *dest_repo)
 {
 	const struct ref *ret;
-	struct strbuf src = STRBUF_INIT;
-	struct strbuf dest = STRBUF_INIT;
 	struct remote *remote;
 	struct transport *transport;
 
-	if (option_shared)
-		add_to_alternates_file(src_repo);
-	else {
+	if (option_shared) {
+		struct strbuf alt = STRBUF_INIT;
+		strbuf_addf(&alt, "%s/objects", src_repo);
+		add_to_alternates_file(alt.buf);
+		strbuf_release(&alt);
+	} else {
+		struct strbuf src = STRBUF_INIT;
+		struct strbuf dest = STRBUF_INIT;
 		strbuf_addf(&src, "%s/objects", src_repo);
 		strbuf_addf(&dest, "%s/objects", dest_repo);
 		copy_or_link_directory(&src, &dest, src_repo, src.len);
Previous: Hui Wang
Message 10 of 10 in “git-clone: fix relative path problem in the alternates”
  1. 0/1 git-clone: fix relative path problem in the alternatesHui Wang, Aug 22, 2011
  2. 1/1 clone: replace relative paths in the alternatesHui Wang, Aug 22, 2011
  3. Junio C HamanoAug 22, 2011
  4. Junio C HamanoAug 22, 2011
  5. Junio C HamanoAug 22, 2011
  6. 0/2 clone-local fixupJunio C Hamano, Aug 23, 2011
  7. 1/2 clone: allow more than one --referenceJunio C Hamano, Aug 23, 2011
  8. 2/2 clone: clone from a repository with relative alternatesJunio C Hamano, Aug 23, 2011
  9. Hui WangAug 23, 2011
  10. Junio C HamanoAug 23, 2011

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.