Hi,

I currently use password store with multi git repository. All work great but the command "pass git" only accept one git repository in the ~/.password-store directory.

So I have create a patch to add the option -C.

For exemple, if you want to pull the directory ~/password-store/myrepo/, just type :

pass git -C myrepo pull

Regards,

Philippe Beaumont
>From 54d088b779689049e418f72332c98ee64d1e9932 Mon Sep 17 00:00:00 2001
From: Philippe BEAUMONT <[email protected]>
Date: Tue, 28 Mar 2017 18:41:27 +0200
Subject: [PATCH] add possibility to use git in a sub-folder for multi repo
 usage

---
 man/pass.1            | 2 +-
 src/password-store.sh | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/man/pass.1 b/man/pass.1
index e842178..c254b54 100644
--- a/man/pass.1
+++ b/man/pass.1
@@ -159,7 +159,7 @@ silently overwrite \fInew-path\fP if it exists. If \fInew-path\fP ends in a
 trailing \fI/\fP, it is always treated as a directory. Passwords are selectively
 reencrypted to the corresponding keys of their new destination.
 .TP
-\fBgit\fP \fIgit-command-args\fP...
+\fBgit\fP \[ \fI-C sub-folder\fP ] fIgit-command-args\fP...
 If the password store is a git repository, pass \fIgit-command-args\fP as arguments to
 .BR git (1)
 using the password store as the git repository. If \fIgit-command-args\fP is \fBinit\fP,
diff --git a/src/password-store.sh b/src/password-store.sh
index bad8d4f..3f3a0a3 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -285,7 +285,7 @@ cmd_usage() {
 	        Renames or moves old-path to new-path, optionally forcefully, selectively reencrypting.
 	    $PROGRAM cp [--force,-f] old-path new-path
 	        Copies old-path to new-path, optionally forcefully, selectively reencrypting.
-	    $PROGRAM git git-command-args...
+	    $PROGRAM git [-C subfolder] git-command-args...
 	        If the password store is a git repository, execute a git command
 	        specified by git-command-args.
 	    $PROGRAM help
@@ -627,6 +627,10 @@ cmd_copy_move() {
 }
 
 cmd_git() {
+	if [[ $1 == "-C" && -n $2 && -d "$PREFIX/$2" ]]; then
+		PREFIX="$PREFIX/$2"
+		shift 2
+	fi
 	set_git "$PREFIX/"
 	if [[ $1 == "init" ]]; then
 		INNER_GIT_DIR="$PREFIX"
-- 
2.9.3

_______________________________________________
Password-Store mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/password-store

Reply via email to