From 4447badcd22a889d656192803eff1003602839c5 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 17 Sep 2005 11:56:41 -0700 Subject: Teach rsync transport about alternates. For local operations and downloading and uploading via git aware protocols, use of $GIT_OBJECT_DIRECTORY/info/alternates is recommended on the server side for big projects that are derived from another one (like Linux kernel). However, dumb protocols and rsync transport needs to resolve this on the client end, which we did not bother doing until this week. I noticed we use "rsync -z" but most of our payload is already compressed, which was not quite right. This commit also fixes it. Signed-off-by: Junio C Hamano --- git-parse-remote.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'git-parse-remote.sh') diff --git a/git-parse-remote.sh b/git-parse-remote.sh index 3c5d94b344..a9db0cd825 100755 --- a/git-parse-remote.sh +++ b/git-parse-remote.sh @@ -153,3 +153,24 @@ get_remote_refs_for_fetch () { ;; esac } + +resolve_alternates () { + # original URL (xxx.git) + top_=`expr "$1" : '\([^:]*:/*[^/]*\)/'` + while read path + do + case "$path" in + \#* | '') + continue ;; + /*) + echo "$top_$path/" ;; + ../*) + # relative -- ugly but seems to work. + echo "$1/objects/$path/" ;; + *) + # exit code may not be caught by the reader. + echo "bad alternate: $path" + exit 1 ;; + esac + done +} -- cgit v1.2.3