summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/password-store.sh25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index a3fd640..572ce2a 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -29,9 +29,9 @@ git_add_file() {
git_commit "$2"
}
git_commit() {
- local sign
+ local sign=""
[[ -d $GIT_DIR ]] || return
- [[ $(git config --bool --get pass.signcommits) == "true" ]] && sign="-S" || sign=""
+ [[ $(git config --bool --get pass.signcommits) == "true" ]] && sign="-S"
git commit $sign -m "$1"
}
yesno() {
@@ -114,6 +114,12 @@ reencrypt_path() {
prev_gpg_recipients="${GPG_RECIPIENTS[@]}"
done
}
+remove_empty_directories() {
+ local old_dir="$1"
+ while rmdir "$old_dir" &>/dev/null; do
+ old_dir="${old_dir%/*}"
+ done
+}
#
# END helper functions
@@ -275,10 +281,7 @@ cmd_init() {
git rm -qr "$gpg_id"
git_commit "Deinitialized ${gpg_id}."
fi
- gpg_id="${gpg_id%/*}"
- while rmdir "$gpg_id" &>/dev/null; do
- gpg_id="${gpg_id%/*}"
- done
+ remove_empty_directories "${gpg_id%/*}"
exit 0
fi
@@ -542,10 +545,7 @@ cmd_delete() {
git rm -qr "$passfile"
git_commit "Removed $path from store."
fi
- passfile="${passfile%/*}"
- while rmdir "$passfile" &>/dev/null; do
- passfile="${passfile%/*}"
- done
+ remove_empty_directories "${passfile%/*}"
}
cmd_copy_move() {
@@ -593,10 +593,7 @@ cmd_copy_move() {
git rm -qr "$old_path"
git_add_file "$new_path" "Renamed ${1} to ${2}."
fi
-
- while rmdir "$old_dir" &>/dev/null; do
- old_dir="${old_dir%/*}"
- done
+ remove_empty_directories "$old_dir"
else
cp $interactive -r -v "$old_path" "$new_path" || exit 1
[[ -e "$new_path" ]] && reencrypt_path "$new_path"
title='2012-09-08 02:06:57 +0200'>2012-09-08Move completion files to contrib.1.1.4Jason A. Donenfeld3-2/+2 2012-09-08Import ZSH completion file from Johan Venant <jvenant@invicem.pro>.Jason A. Donenfeld3-1/+75 2012-09-08More info in INSTALL.Jason A. Donenfeld1-0/+9 2012-09-08Simplify README.Jason A. Donenfeld1-17/+2 2012-09-08Fedora wants the whole license in COPYING.Jason A. Donenfeld1-12/+352 2012-09-07Update FSF address, add copyrights.1.1.3Jason A. Donenfeld4-21/+26 2012-09-07Bump debian to 1.1.3.Jason A. Donenfeld1-1/+1 2012-09-07Explicitly set permissions when running 'install'Christophe Fergeau1-3/+3 2012-09-07No need for a shebang in bash completion fileChristophe Fergeau1-1/+1 2012-09-06Update COPYING to reflect man page and project page.1.1.2Jason A. Donenfeld1-10/+11 2012-09-06Use BINDIR, MANDIR and SYSCONFDIR vars in MakefileChristophe Fergeau1-5/+8 2012-09-06Add dependencies to README.Jason A. Donenfeld1-0/+8 2012-09-06Change debian name.Jason A. Donenfeld5-5/+4 2012-09-06Use more normal sleep variant.1.1.1Jason A. Donenfeld1-1/+1 2012-09-06Use --noreport instead of head -n -2 for tree so that it works on mac.Jason A. Donenfeld1-1/+1 2012-09-05Be sure to explicitly state that install is a phony target.Jason A. Donenfeld1-0/+2 2012-09-05Bump debian version horribly.1.1Jason A. Donenfeld2-2/+2 2012-09-04No echo mode.Jason A. Donenfeld2-16/+42 2012-09-04Properly quote the path too.Jason A. Donenfeld1-1/+1 2012-09-04Allow passwords having spaces to go unbroken to the clipboard.Bernardo Freitas Paulo da Costa1-1/+1 2012-09-04Separate out the massive git example.Jason A. Donenfeld1-10/+14 2012-09-04Prepare for debianification.1.0Jason A. Donenfeld9-4/+60 2012-09-03Fix readme typo.Jason A. Donenfeld1-1/+1 2012-09-03Show program name properly in error message.Jason A. Donenfeld1-1/+1 2012-09-03Move examples into manpage.Jason A. Donenfeld4-93/+224 2012-09-03Make into a real project.Jason A. Donenfeld8-5/+173 2012-09-03Support pass gitJason A. Donenfeld2-1/+15 2012-08-31Add remove synonyms.Jason A. Donenfeld1-2/+2 2012-08-31Use basename in usage.Jason A. Donenfeld1-2/+1 2012-08-19now using gpg_id as a varMatthew Ramirez1-2/+2 2012-08-07Forty five seconds.Jason A. Donenfeld1-1/+1 2012-08-06Deal with klipper and new lines.Jason A. Donenfeld1-3/+19 2012-08-06Update examples.Jason A. Donenfeld1-7/+7 2012-08-06Update readme.Jason A. Donenfeld1-11/+13 2012-08-06Be slicker and more like git.Jason A. Donenfeld1-114/+173