summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-02-28 13:58:41 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-02-28 13:58:41 -0300
commitf8c90d57f673d9accaa616620660aff70f0d9246 (patch)
treed4d97b9392999f31c8037a7bf53b83c57e13deb3
parent1d33d02bd37cb38b494991ca0f797dfcaea12e39 (diff)
downloadhydra-f8c90d57f673d9accaa616620660aff70f0d9246.tar.gz
hydra-f8c90d57f673d9accaa616620660aff70f0d9246.tar.bz2
Repository initialization
-rw-r--r--README.md (renamed from README)0
-rw-r--r--lib/hydra/git16
-rwxr-xr-xshare/hydra/init20
3 files changed, 21 insertions, 15 deletions
diff --git a/README b/README.md
index 5f635d8..5f635d8 100644
--- a/README
+++ b/README.md
diff --git a/lib/hydra/git b/lib/hydra/git
index 34ba053..0908f54 100644
--- a/lib/hydra/git
+++ b/lib/hydra/git
@@ -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"
+ )
+}
diff --git a/share/hydra/init b/share/hydra/init
index 9b817d0..81898a7 100755
--- a/share/hydra/init
+++ b/share/hydra/init
@@ -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