diff mbox

Fix git clone to get repo without branch name as part of the url.

Message ID 1381187601-7425-1-git-send-email-ryan.arnold@linaro.org
State New
Headers show

Commit Message

Ryan S. Arnold Oct. 7, 2013, 11:13 p.m. UTC
From: "Ryan S. Arnold" <ryan.arnold@linaro.org>

---
 lib/checkout.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/lib/checkout.sh b/lib/checkout.sh
index 17e33ce..6e01bd2 100644
--- a/lib/checkout.sh
+++ b/lib/checkout.sh
@@ -82,7 +82,9 @@  checkout()
 		    dryrun "git clone $1 ${srcdir}"
 		else
 		    if test ! -d ${local_snapshots}/${tool}.git; then
-			dryrun "git clone $1 ${srcdir}"
+			# Strip off the "/<branchname>" from $1 to get the repo address
+		    	local repo="`echo $1 | sed -e "s:\(^.*/${tool}.git\).*:\1:"`"
+			dryrun "git clone ${repo} ${local_snapshots}/${tool}.git"
 		    fi
 		    dryrun "git-new-workdir ${local_snapshots}/${tool}.git ${srcdir} ${branch}"
 		fi