Re: git-clone --reference problem?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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 &&
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]