From amitsaha.in at gmail.com Tue Jul 18 22:14:48 2023 From: amitsaha.in at gmail.com (Amit Saha) Date: Wed, 19 Jul 2023 08:14:48 +1000 Subject: [PATCH] Add clone to pass git Message-ID: This patch adds a clone option to pass git so as to clone an existing password store repository. As it stands, it will clone the repository to $HOME/.password-store and doesn't allow changing that. >From 33e8012a744f76311a567b19a7cd585d1253ec0b Mon Sep 17 00:00:00 2001 From: Amit Saha Date: Wed, 19 Jul 2023 08:02:26 +1000 Subject: [PATCH] Allow cloning an existing git repository for setup --- src/password-store.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/password-store.sh b/src/password-store.sh index 22e818f..6dc87cd 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -46,6 +46,9 @@ git_commit() { [[ $(git -C "$INNER_GIT_DIR" config --bool --get pass.signcommits) == "true" ]] && sign="-S" git -C "$INNER_GIT_DIR" commit $sign -m "$1" } +git_clone() { + git clone "$1" "$2" +} yesno() { [[ -t 0 ]] || return 0 local response @@ -660,6 +663,8 @@ cmd_git() { git_add_file .gitattributes "Configure git repository for gpg file diff." git -C "$INNER_GIT_DIR" config --local diff.gpg.binary true git -C "$INNER_GIT_DIR" config --local diff.gpg.textconv "$GPG -d ${GPG_OPTS[*]}" + elif [[ $1 == "clone" ]]; then + git_clone "$2" "$PREFIX" 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" -- 2.34.1