Re: git-clone --reference problem?
- From
Linus Torvalds <torvalds@osdl.org>
- Date
- Apr 23, 2006, 18:34 UTC
- Message-ID
- <Pine.LNX.4.64.0604231122490.3701@g5.osdl.org>
- 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 &&