]> gitweb.fluxo.info Git - hydra.git/commitdiff
Repository initialization
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 28 Feb 2014 16:58:41 +0000 (13:58 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 28 Feb 2014 16:58:41 +0000 (13:58 -0300)
README.md [moved from README with 100% similarity]
lib/hydra/git
share/hydra/init

similarity index 100%
rename from README
rename to README.md
index 34ba053f95ea039458744b5372e61c007a0e0592..0908f5494194a918658153843a9fe54afb96c3ce 100644 (file)
@@ -31,3 +31,19 @@ function hydra_is_git {
     fi
   fi
 }
+
+# Initialize a repository
+function hydra_git_init {
+  local repo="$1"
+
+  if [ -z "$repo" ] || [ ! -d "$repo" ] || [ -d "$repo/.git" ]; then
+    return
+  fi
+
+  (
+    cd $repo
+    git init
+    git add .
+    git commit -m "Initial import"
+  )
+}
index 9b817d078aef8c5becbfc4c4ac1617275122ecca..81898a724ec3de477ce7ea99b57ac35b89592b74 100755 (executable)
@@ -55,25 +55,15 @@ if [ ! -z "$REMOTE" ]; then
 else
   # No remote was given, so we assume this is a shiny new hydra!
   if [ ! -d "$BASEDIR/config" ]; then
-    mkdir -p "$BASEDIR/config"
-    (
-      cd $BASEDIR/config
-      echo "Hydra $HYDRA config repository" > README.md
-      git init
-      git add .
-      git commit -m "Initial import"
-    )
+    # Setup repository from template
+    cp -r $APP_BASE/share/config $BASEDIR/config
+    hydra_git_init $BASEDIR/config
   fi
 
   if [ ! -d "$BASEDIR/doc" ]; then
     mkdir -p "$BASEDIR/doc"
-    (
-      cd $BASEDIR/doc
-      echo "Use this repository for notes about Hydra $HYDRA" > README.md
-      git init
-      git add .
-      git commit -m "Initial import"
-    )
+    echo "Use this repository for notes about Hydra $HYDRA" > $BASEDIR/doc/README.md
+    hydra_git_init $BASEDIR/doc
   fi
 fi