Patch for supporting git-alternates

David Yen dyen at chromium.org
Thu Jun 19 10:45:36 PDT 2014


Hello,

I would like to submit a simple patch to support git alternates when
running GetRepositoryPath.

------------------------------------------
Support git alternates when obtaining remote repository paths.

When git alternates are being used, this simply goes into the git
alternates directory before running the "git remote" command.

-David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140619/3b90a74f/attachment.html>
-------------- next part --------------
diff --git a/utils/GetRepositoryPath b/utils/GetRepositoryPath
index 2d1122e..80992d8 100755
--- a/utils/GetRepositoryPath
+++ b/utils/GetRepositoryPath
@@ -19,8 +19,12 @@ if [ -d .svn ]; then
 elif [ -f .git/svn/.metadata ]; then
   git svn info | grep 'URL:' | cut -d: -f2-
 elif [ -d .git ]; then
+  if [ -f .git/objects/info/alternates ]; then
+    cd `cat .git/objects/info/alternates`
+  fi
   git remote -v | grep 'fetch' | awk '{ print $2 }' | head -n1
 else
+  echo "Invalid Repository Path: $1" 1>&2
   exit 1;
 fi
 


More information about the llvm-commits mailing list