[PATCH] git: don't attempt to add ignored files to repo

Victor Luft 0 at 0u.io
Sun Jun 2 23:14:53 CEST 2019


With some workflows (in my use, using aws-vault to generate and cache
ephemeral AWS credentials), it may be desirable to store entries that
don't pollute the git log. Adding entries to .gitignore is effective for
this, but currently results in a complaint from git that would be nice
to silence. This commit will short circuit git_add_file if the argument
is ignored, and is compatible back to at least git 2.3.0.
---
 src/password-store.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/password-store.sh b/src/password-store.sh
index 284eabf..fbffd77 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -35,6 +35,7 @@ set_git() {
 }
 git_add_file() {
 	[[ -n $INNER_GIT_DIR ]] || return
+	git -C "$INNER_GIT_DIR" check-ignore -q "$1" && return
 	git -C "$INNER_GIT_DIR" add "$1" || return
 	[[ -n $(git -C "$INNER_GIT_DIR" status --porcelain "$1") ]] || return
 	git_commit "$2"
--
2.21.0



More information about the Password-Store mailing list