m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-02-05 02:26:30 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2016-02-05 02:26:30 +0100
commitd2677f66eb127aa92cf032a925944dd0b44f15ef (patch)
tree9114e93c05f1d6cb3968df67fdf05d2a63c5afbd
parent1c50cbefb2e636a9b6c76e90c2a287acfa8d3f30 (diff)
Fix up moving ambiguity too
-rwxr-xr-xsrc/password-store.sh11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index 8b640bd..6f85d3b 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -493,7 +493,7 @@ cmd_delete() {
local passdir="$PREFIX/${path%/}"
local passfile="$PREFIX/$path.gpg"
[[ -f $passfile && -d $passdir && $path == */ || ! -f $passfile ]] && passfile="$passdir"
- [[ ! -e $passfile ]] && die "Error: $path is not in the password store."
+ [[ -e $passfile ]] || die "Error: $path is not in the password store."
[[ $force -eq 1 ]] || yesno "Are you sure you would like to delete $path?"
@@ -519,17 +519,18 @@ cmd_copy_move() {
[[ $# -ne 2 ]] && die "Usage: $PROGRAM $COMMAND [--force,-f] old-path new-path"
check_sneaky_paths "$@"
local old_path="$PREFIX/${1%/}"
- local new_path="$PREFIX/$2"
local old_dir="$old_path"
+ local new_path="$PREFIX/$2"
- if [[ ! -d $old_path ]]; then
+ if ! [[ -f $old_path.gpg && -d $old_path && $1 == */ || ! -f $old_path.gpg ]]; then
old_dir="${old_path%/*}"
old_path="${old_path}.gpg"
- [[ ! -f $old_path ]] && die "Error: $1 is not in the password store."
fi
+ echo "$old_path"
+ [[ -e $old_path ]] || die "Error: $1 is not in the password store."
mkdir -p -v "${new_path%/*}"
- [[ -d $old_path || -d $new_path || $new_path =~ /$ ]] || new_path="${new_path}.gpg"
+ [[ -d $old_path || -d $new_path || $new_path == */ ]] || new_path="${new_path}.gpg"
local interactive="-i"
[[ ! -t 0 || $force -eq 1 ]] && interactive="-f"