[Lunar-commits] <moonbase> download-git.plugin: revert the mess

Samuel Verstraete elangelo at lunar-linux.org
Wed Dec 9 13:41:46 CET 2009


commit ac9163fead0cea2c59e60115c8ed4d3a4cb35699
Author: Samuel Verstraete <elangelo at lunar-linux.org>
Date:   Wed Dec 9 13:41:46 2009 +0100

    download-git.plugin: revert the mess
---
 devel/git/plugin.d/download-git.plugin |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/devel/git/plugin.d/download-git.plugin b/devel/git/plugin.d/download-git.plugin
index 1b28551..f933501 100644
--- a/devel/git/plugin.d/download-git.plugin
+++ b/devel/git/plugin.d/download-git.plugin
@@ -30,6 +30,8 @@ plugin_source_download_git() {
   fi
 
   GIT_URL=$(echo $1 | cut -d: -f1-2)
+  GIT_BRANCH=$(echo $1 | cut -s -d: -f3)
+
   # translate git+http(s) urls:
   if [ "${GIT_URL:0:8}" == "git+http" ]; then
     GIT_URL="${GIT_URL:4}"
@@ -64,10 +66,26 @@ plugin_source_download_git() {
       cd $SBASE
       verbose_msg "[${TRY}] git pull"
       git pull && git gc && GOT_GIT="yes" 
+      message "${MESSAGE_COLOR}Init and update the submodules${DEFAULT_COLOR}"
+      git submodule init
+      git submodule update
+      if [ -n "$GIT_BRANCH" ] ; then
+        message "${MESSAGE_COLOR}Checking out branch ${FILE_COLOR}$GIT_BRANCH${DEFAULT_COLOR}"
+        git checkout $GIT_BRANCH || activity_log "lget" "$MODULE" "$VERSION" "failed" "Could not checkout branch $GIT_BRANCH of \"$1\""
+      fi
       cd ${CD}
     else
       verbose_msg "[${TRY}] git clone $GIT_URL"
       git clone $GIT_URL $SBASE && GOT_GIT="yes"
+      cd $SBASE
+      message "${MESSAGE_COLOR}Init and update the submodules${DEFAULT_COLOR}"
+      git submodule init
+      git submodule update
+      if [ -n "$GIT_BRANCH" ] ; then
+        message "${MESSAGE_COLOR}Checking out branch ${FILE_COLOR}$GIT_BRANCH${DEFAULT_COLOR}"
+        git checkout $GIT_BRANCH || activity_log "lget" "$MODULE" "$VERSION" "failed" "Could not checkout branch $GIT_BRANCH of \"$1\""
+      fi
+      cd $TMPDIR/$MODULE-$VERSION
     fi
 
     if [ "$?" == "0" ] ; then


More information about the Lunar-commits mailing list