# [PATCH] ls-remote fix for rsync:// transport

2 messages from 2006-05-25 to 2006-05-25. Participants: Junio C Hamano, Sean.
Thread: https://gitlist.dev/t/4286

## Junio C Hamano, 2006-05-25 04:22

Subject: [PATCH] ls-remote fix for rsync:// transport
Message-ID: <7v7j4a3f9i.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v7j4a3f9i.fsf%40assigned-by-dhcp.cox.net

```
I think this would fix the "cloning rsync:// clones repository fine but
does not check out the working tree" problem.

---
diff --git a/git-ls-remote.sh b/git-ls-remote.sh
index b6882a9..6b21879 100755
--- a/git-ls-remote.sh
+++ b/git-ls-remote.sh
@@ -58,7 +58,8 @@ http://* | https://* )
 	;;
 
 rsync://* )
-	mkdir $tmpdir
+	mkdir $tmpdir &&
+	rsync -rlq "$peek_repo/HEAD" $tmpdir &&
 	rsync -rq "$peek_repo/refs" $tmpdir || {
 		echo "failed	slurping"
 		exit
@@ -69,6 +70,13 @@ rsync://* )
 		cat "$tmpdir/$path" | tr -d '\012'
 		echo "	$path"
 	done &&
+	head=$(cat "$tmpdir/HEAD") &&
+	case "$head" in
+	ref:' '*)
+		head=$(expr "z$head" : 'zref: \(.*\)') &&
+		head=$(cat "$tmpdir/$head") || exit
+	esac &&
+	echo "$head	HEAD" 
 	rm -fr $tmpdir
 	;;
 

```

## Sean, 2006-05-25 05:01

Subject: Re: [PATCH] ls-remote fix for rsync:// transport
Message-ID: <BAYC1-PASMTP073667D87F8BC653B62894AE990@CEZ.ICE>
URL: https://gitlist.dev/e/BAYC1-PASMTP073667D87F8BC653B62894AE990%40CEZ.ICE
In-Reply-To: <7v7j4a3f9i.fsf@assigned-by-dhcp.cox.net>

```
On Wed, 24 May 2006 21:22:17 -0700
Junio C Hamano <junkio@cox.net> wrote:

> I think this would fix the "cloning rsync:// clones repository fine but
> does not check out the working tree" problem.

Nice find, works here.

Sean

```
