add git tracking to contrib/ scripts
arĉi arcxi@dismail.de
Sun, 23 Jun 2024 08:22:02 +0200
3 files changed,
10 insertions(+),
2 deletions(-)
M
contrib/pa-pass
→
contrib/pa-pass
@@ -20,3 +20,7 @@ mkdir -p "$PA_DIR/$(dirname "$name")"
gpg2 -d "$passfile" | $age -R "$basedir/recipients" -o "$PA_DIR/$name.age" printf '%s\n' "Saved '$name' to the store." done + +if [ -z "${PA_NOGIT+x}" ] && [ -d "$PA_DIR/.git" ] && command -v git >/dev/null 2>&1; then + git -C "$PA_DIR" add . && git -C "$PA_DIR" commit -m "migrate from pass" +fi
M
contrib/pa-rekey
→
contrib/pa-rekey
@@ -15,7 +15,7 @@ [ "$PA_IDENTITIES" ] && cp "$PA_IDENTITIES" "$basedir/identities.tmp"
[ "$PA_RECIPIENTS" ] && cp "$PA_RECIPIENTS" "$basedir/recipients.tmp" if age_keygen=$(command -v age-keygen || command -v rage-keygen); then - $age_keygen >>"$basedir/identities.tmp" 2>/dev/null && + $age_keygen >>"$basedir/identities.tmp" 2>/dev/null $age_keygen -y "$basedir/identities.tmp" >>"$basedir/recipients.tmp" 2>/dev/null fi@@ -30,3 +30,7 @@ if [ "$age_keygen" ]; then
mv "$basedir/identities.tmp" "$basedir/identities" mv "$basedir/recipients.tmp" "$basedir/recipients" fi + +if [ -z "${PA_NOGIT+x}" ] && [ -d "$PA_DIR/.git" ] && command -v git >/dev/null 2>&1; then + git -C "$PA_DIR" add . && git -C "$PA_DIR" commit -m "rekey" +fi
M
pa
→
pa
@@ -250,7 +250,7 @@
# Configure diff driver for age encrypted files that treats them as # binary and decrypts them when a human-readable diff is requested. git config diff.age.binary true - git config diff.age.textconv "$age --decrypt -i \"$identities_file\"" + git config diff.age.textconv "$age --decrypt -i '$identities_file'" # Assign this diff driver to all passwords. printf '%s\n' '*.age diff=age' >.gitattributes