aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2010-09-03 18:00:16 -0300
committerSilvio Rhatto <rhatto@riseup.net>2010-09-03 18:00:16 -0300
commit2fa8a56a198c34ffe9404a4a148fed77b9a0cbf6 (patch)
tree38ddac2ef2b8108c3785e086958f37c173ef2b8d
parent8075cff27d4d17d2f9d69c43f9774392b03a5560 (diff)
downloadkeyringer-2fa8a56a198c34ffe9404a4a148fed77b9a0cbf6.tar.gz
keyringer-2fa8a56a198c34ffe9404a4a148fed77b9a0cbf6.tar.bz2
Adding keyringer_git_ignore
-rw-r--r--lib/keyringer/functions23
-rwxr-xr-xshare/keyringer/edit1
2 files changed, 19 insertions, 5 deletions
diff --git a/lib/keyringer/functions b/lib/keyringer/functions
index dd0de03..22f16f8 100644
--- a/lib/keyringer/functions
+++ b/lib/keyringer/functions
@@ -112,22 +112,23 @@ function keyringer_set_tmpfile {
exit 1
fi
- mkdir -p $BASEDIR/tmp
-
if [ -z "$1" ]; then
template="$BASEDIR/tmp/keyringer.XXXXXXXXXX"
else
template="$BASEDIR/tmp/$1.XXXXXXXXXX"
fi
- TMPFILE="`mktemp $template`" || exit 1
+ mkdir -p $BASEDIR/tmp
+ keyringer_git_ignore 'tmp/*'
+
+ tmpfile="`mktemp $template`"
if [ "$?" != "0" ]; then
- echo "Error: can't set tmpfile $TMPFILE"
+ echo "Error: can't set tmpfile $tmpfile"
exit 1
fi
- echo $TMPFILE
+ echo $tmpfile
}
# Remove a temporary file
@@ -143,3 +144,15 @@ function keyringer_unset_tmpfile {
exit 1
fi
}
+
+# Add a pattern into gitignore
+function keyringer_git_ignore {
+ if [ ! -z "$BASEDIR/.gitignore" ]; then
+ echo $1 > $BASEDIR/.gitignore
+ keyringer_exec git $BASEDIR add .gitignore
+ else
+ if ! grep -q -e "^$1$" $BASEDIR/.gitignore; then
+ echo $1 >> $BASEDIR/.gitignore
+ fi
+ fi
+}
diff --git a/share/keyringer/edit b/share/keyringer/edit
index 153e236..b5cc4ae 100755
--- a/share/keyringer/edit
+++ b/share/keyringer/edit
@@ -8,6 +8,7 @@ LIB="`dirname $0`/../../lib/keyringer/functions"
source $LIB
# Config
+ACTIONS="`dirname $0`"
BASEDIR="$1"
FILE="`keyringer_filename $2`"
KEYDIR="$BASEDIR/keys"