summaryrefslogtreecommitdiff
path: root/lib/git
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2010-09-22 16:29:40 -0300
committerSilvio Rhatto <rhatto@riseup.net>2010-09-22 16:29:40 -0300
commitfec2db557dcad1f52a1ffa8b612629a0b8b4c054 (patch)
tree5e1305477007f7720027fa5974824937aa4ffe63 /lib/git
parent9d4d507a6c86412f1815efc1e9345f37f0956465 (diff)
downloadhydra-fec2db557dcad1f52a1ffa8b612629a0b8b4c054.tar.gz
hydra-fec2db557dcad1f52a1ffa8b612629a0b8b4c054.tar.bz2
App skeleton
Diffstat (limited to 'lib/git')
-rw-r--r--lib/git33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/git b/lib/git
new file mode 100644
index 0000000..6e7f05a
--- /dev/null
+++ b/lib/git
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# Add a pattern into gitignore
+function hydra_git_ignore {
+ if [ ! -z "$BASEDIR/.gitignore" ]; then
+ echo $1 > $BASEDIR/.gitignore
+ hydra_exec git $BASEDIR add .gitignore
+ else
+ if ! grep -q -e "^$1$" $BASEDIR/.gitignore; then
+ echo $1 >> $BASEDIR/.gitignore
+ fi
+ fi
+}
+
+# Check if a folder is inside a git repository
+function hydra_is_git {
+ if [ -z "$1" ]; then
+ false
+ elif [ ! -d "$1" ]; then
+ false
+ elif [ -d "$1/.git" ]; then
+ true
+ else
+ cwd="`pwd`"
+ cd $1 && git="`git status &> /dev/null`" && cd $cwd
+
+ if [ "$git" != "128" ]; then
+ true
+ else
+ false
+ fi
+ fi
+}