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);