aboutsummaryrefslogtreecommitdiffstats
path: root/git-parse-remote.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-09-17 11:56:41 -0700
committerJunio C Hamano <junkio@cox.net>2005-09-17 11:56:41 -0700
commit4447badcd22a889d656192803eff1003602839c5 (patch)
tree6194c273a13907fea9bb5df76e681bec1c9df462 /git-parse-remote.sh
parent8805ccac40348094d26b3b892c6ca3d08dc12ae0 (diff)
downloadgit-4447badcd22a889d656192803eff1003602839c5.tar.gz
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 <junkio@cox.net>
Diffstat (limited to 'git-parse-remote.sh')
-rwxr-xr-xgit-parse-remote.sh21
1 files changed, 21 insertions, 0 deletions
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
+}