summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-04-18 12:57:45 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2014-04-18 12:57:45 +0200
commit8066a2b222a31cf5ac217de5e26a267a2100940e (patch)
treed5ef0fdc1b00e3a32d38773dc00d1ce232b5f00f
parentac045fe4254306fbcc32ffce058b860d5a473b98 (diff)
downloadpass-8066a2b222a31cf5ac217de5e26a267a2100940e.tar.gz
pass-8066a2b222a31cf5ac217de5e26a267a2100940e.tar.bz2
pass-8066a2b222a31cf5ac217de5e26a267a2100940e.zip
Pruning: turns out rmdir does it for us with -p.
Diffstat (limited to '')
-rwxr-xr-xsrc/password-store.sh12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index 572ce2a..f80f026 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -114,12 +114,6 @@ 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
@@ -281,7 +275,7 @@ cmd_init() {
git rm -qr "$gpg_id"
git_commit "Deinitialized ${gpg_id}."
fi
- remove_empty_directories "${gpg_id%/*}"
+ rmdir -p "${gpg_id%/*}" 2>/dev/null
exit 0
fi
@@ -545,7 +539,7 @@ cmd_delete() {
git rm -qr "$passfile"
git_commit "Removed $path from store."
fi
- remove_empty_directories "${passfile%/*}"
+ rmdir -p "${passfile%/*}" 2>/dev/null
}
cmd_copy_move() {
@@ -593,7 +587,7 @@ cmd_copy_move() {
git rm -qr "$old_path"
git_add_file "$new_path" "Renamed ${1} to ${2}."
fi
- remove_empty_directories "$old_dir"
+ rmdir -p "$old_dir" 2>/dev/null
else
cp $interactive -r -v "$old_path" "$new_path" || exit 1
[[ -e "$new_path" ]] && reencrypt_path "$new_path"