summaryrefslogtreecommitdiff
path: root/src/password-store.sh
diff options
context:
space:
mode:
authorKevin Lyda <kevin@ie.suberic.net>2017-02-15 15:18:40 +0000
committerJason A. Donenfeld <Jason@zx2c4.com>2017-02-25 13:55:09 +0100
commit2266c8e6cde59207f7b6ecf0985829b8823f1b63 (patch)
tree36887df7600f00a6c130c8f2f3f3f9eb67ede89a /src/password-store.sh
parent250207d21474fb8e6e86fc47722ce516ba81b74f (diff)
downloadpass-2266c8e6cde59207f7b6ecf0985829b8823f1b63.tar.gz
pass-2266c8e6cde59207f7b6ecf0985829b8823f1b63.tar.bz2
pass-2266c8e6cde59207f7b6ecf0985829b8823f1b63.zip
Support git worktree.
Git worktree works with the normal .git directory instead being a .git file with a reference to the primary git repository.
Diffstat (limited to 'src/password-store.sh')
-rwxr-xr-xsrc/password-store.sh12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index e8948a1..ce140db 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -28,14 +28,14 @@ export GIT_WORK_TREE="${PASSWORD_STORE_GIT:-$PREFIX}"
#
git_add_file() {
- [[ -d $GIT_DIR ]] || return
+ [[ -e $GIT_DIR ]] || return
git add "$1" || return
[[ -n $(git status --porcelain "$1") ]] || return
git_commit "$2"
}
git_commit() {
local sign=""
- [[ -d $GIT_DIR ]] || return
+ [[ -e $GIT_DIR ]] || return
[[ $(git config --bool --get pass.signcommits) == "true" ]] && sign="-S"
git commit $sign -m "$1"
}
@@ -310,7 +310,7 @@ cmd_init() {
if [[ $# -eq 1 && -z $1 ]]; then
[[ ! -f "$gpg_id" ]] && die "Error: $gpg_id does not exist and so cannot be removed."
rm -v -f "$gpg_id" || exit 1
- if [[ -d $GIT_DIR ]]; then
+ if [[ -e $GIT_DIR ]]; then
git rm -qr "$gpg_id"
git_commit "Deinitialize ${gpg_id}${id_path:+ ($id_path)}."
fi
@@ -551,7 +551,7 @@ cmd_delete() {
[[ $force -eq 1 ]] || yesno "Are you sure you would like to delete $path?"
rm $recursive -f -v "$passfile"
- if [[ -d $GIT_DIR && ! -e $passfile ]]; then
+ if [[ -e $GIT_DIR && ! -e $passfile ]]; then
git rm -qr "$passfile"
git_commit "Remove $path from store."
fi
@@ -592,7 +592,7 @@ cmd_copy_move() {
mv $interactive -v "$old_path" "$new_path" || exit 1
[[ -e "$new_path" ]] && reencrypt_path "$new_path"
- if [[ -d $GIT_DIR && ! -e $old_path ]]; then
+ if [[ -e $GIT_DIR && ! -e $old_path ]]; then
git rm -qr "$old_path"
git_add_file "$new_path" "Rename ${1} to ${2}."
fi
@@ -613,7 +613,7 @@ cmd_git() {
git_add_file .gitattributes "Configure git repository for gpg file diff."
git config --local diff.gpg.binary true
git config --local diff.gpg.textconv "$GPG -d ${GPG_OPTS[*]}"
- elif [[ -d $GIT_DIR ]]; then
+ elif [[ -e $GIT_DIR ]]; then
tmpdir nowarn #Defines $SECURE_TMPDIR. We don't warn, because at most, this only copies encrypted files.
export TMPDIR="$SECURE_TMPDIR"
git "$@"
>Jason A. Donenfeld1-1/+1 2014-05-14Don't define tmpdir on git init.Jason A. Donenfeld1-4/+3 2014-05-14Disable secmem warning when discovering keysmilki2-2/+2 2014-05-10edit: Quote editor so tests work in spaced directories.Jason A. Donenfeld1-1/+1 2014-05-10reencryption: Properly escape input to sedJason A. Donenfeld1-1/+1 2014-05-10git: use secure tmp directoryJason A. Donenfeld1-4/+11 2014-05-10configure git to decrypt gpg files automaticallySamuel Le Thiec1-0/+5 2014-05-08completion: add new generate flagsJason A. Donenfeld3-2/+7 2014-05-08inplace: mutually exclusive with forceJason A. Donenfeld2-3/+3 2014-05-08usage: tab to spacesJason A. Donenfeld1-1/+1 2014-05-08generate: use nice ansi colors instead.Jason A. Donenfeld1-3/+2 2014-05-08zsh: posix compatible sed fix for zsh-completionJason A. Donenfeld1-1/+1 2014-05-07Implement interactive init functionSvend Sorensen1-0/+8 2014-05-07Implement interactive rename functionSvend Sorensen1-0/+7 2014-05-07Reorder interactive function to match order of helper functionsSvend Sorensen1-13/+13 2014-05-07Make edit helper function name consistent with other helpersSvend Sorensen1-1/+1 2014-05-07Factor out password completing-read functionSvend Sorensen1-4/+8 2014-05-07Add dash to Package-RequiresSvend Sorensen1-1/+1 2014-05-06Force sane sort order.Jason A. Donenfeld1-2/+2 2014-05-06generate: add --in-place optionJason A. Donenfeld4-9/+33