Hello,
I found while using `pass` that git commands have their exit code dropped, so
if I ran something like, `pass git fetch && pass git merge @{u} && exit`, if
the fetch failed, the subsequent commands would still run. This patch exits
with git's error code if we see a git sub-command fail.
Many thanks,
Rob
From dc0552fc7d38f3f694fb7731fd85a3ad04b91445 Mon Sep 17 00:00:00 2001
From: Rob Pilling <[email protected]>
Date: Wed, 17 Jun 2020 20:02:24 +0100
Subject: [PATCH] Exit with git's error code for `pass git [...]`
---
src/password-store.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/password-store.sh b/src/password-store.sh
index 77f3eda..aa8c745 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -661,7 +661,7 @@ cmd_git() {
elif [[ -n $INNER_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 -C "$INNER_GIT_DIR" "$@"
+ git -C "$INNER_GIT_DIR" "$@" || exit $?
else
die "Error: the password store is not a git repository. Try \"$PROGRAM git init\"."
fi
--
2.20.1