git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: David Woodhouse <dwmw2@infradead.org>
Cc: git@vger.kernel.org
Subject: Re: git-clone --reference problem?
Date: Sun, 23 Apr 2006 11:34:24 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0604231122490.3701@g5.osdl.org> (raw)
In-Reply-To: <1145810080.16166.223.camel@shinybook.infradead.org>



On Sun, 23 Apr 2006, David Woodhouse wrote:
>
> Should I expect cloning with alternates using '--reference' to be
> transitive?

Well, certainly not now.

> Using '--reference clone1 --reference linux-2.6' for the second clone
> works OK, but surely it ought to work with just '--reference clone1'? 

Actually, I don't think using "--reference clone1 --reference linux-2.6" 
works OK at all - in the sense that it doesn't do what you _think_ it 
does.

It doesn't use two reference repos at all: it uses just one, which is the 
last one (ie linux-2.6).

Maybe something like this could work.

Untested, of course. It probably isn't even syntactically correct shell. 
Whatever. You get the idea.

(That while-loop could probably be simplified to just a 

  cat ""$reference/objects/info/alternates" >> "$GIT_DIR/objects/info/alternates"

because all alternates _should_ already be absolute paths, but hey, 
whatever. I also forget whether we decided that non-absolute paths were 
relative to the $reference directory, or to the $reference/objects/ 
directory. The while-loop should be fixed to match whatever that decision 
was (or just not accept anything but absolute paths: make it use a

	grep '^/' ..

instead of "cat"?)

		Linus

---
diff --git a/git-clone.sh b/git-clone.sh
index 0805168..df4c135 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -221,6 +221,13 @@ then
 		fi
 		reference=$(cd "$reference" && pwd)
 		echo "$reference/objects" >"$GIT_DIR/objects/info/alternates"
+		if test -s "$reference/objects/info/alternates"
+		then
+			while read alt
+			do
+				echo $(cd "$reference" && cd "$alt" && pwd) >> "$GIT_DIR/objects/info/alternates"
+			done < "$reference/objects/info/alternates"
+		fi
 		(cd "$reference" && tar cf - refs) |
 		(cd "$GIT_DIR/refs" &&
 		 mkdir reference-tmp &&

  parent reply	other threads:[~2006-04-23 18:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-23 16:34 git-clone --reference problem? David Woodhouse
2006-04-23 17:50 ` Junio C Hamano
2006-04-23 18:34 ` Linus Torvalds [this message]
2006-04-23 18:40   ` Linus Torvalds
2006-04-24  8:12   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0604231122490.3701@g5.osdl.org \
    --to=torvalds@osdl.org \
    --cc=dwmw2@infradead.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).