]> gitweb.fluxo.info Git - templater.git/commitdiff
Puppet: check for a clean git repo
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 27 Oct 2017 13:08:24 +0000 (11:08 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 27 Oct 2017 13:08:24 +0000 (11:08 -0200)
templater

index 8061ec867f78460f6a7a24ffab81d0a70fc1ce97..420d661c2511e64cc257366779c181a01acdfd4e 100755 (executable)
--- a/templater
+++ b/templater
@@ -164,17 +164,21 @@ function templater_puppet {
   if [ ! -d "puppet" ]; then
     __templater___templater_echo "Setting up puppet..."
 
-    # Use the best approach
-    if [ -d '.git' ]; then
-      #git clone $BOOSTRAP $PROJECT/puppet
-      #git submodule add $BOOSTRAP puppet
-      git remote add puppet $BOOTSTRAP
-      git add .
-      git commit -m "Commiting changes before running git-subtree"
-      git subtree add --prefix puppet $BOOTSTRAP master --squash
-    else
-      git clone $BOOSTRAP puppet
+    if [ ! -d '.git' ]; then
+      __templater_echo "Error: puppet needs a working git setup, skipping"
+      return
+    fi
+
+    if [ "`git status -s | wc -l`" != 0 ]; then
+      __templater_echo "Please commit changes before running setting up puppet"
+      return
     fi
+
+    # Use the best approach
+    #git clone $BOOSTRAP puppet
+    #git submodule add $BOOSTRAP puppet
+    git remote add puppet $BOOTSTRAP
+    git subtree add --prefix puppet $BOOTSTRAP master --squash
   else
     __templater_echo "Puppet already set"
   fi