clean git implementation slightly
Jes Olson j3s@c3f.net
Mon, 30 Sep 2024 20:18:59 -0400
1 files changed,
8 insertions(+),
4 deletions(-)
jump to
M
pa
→
pa
@@ -40,7 +40,7 @@ die "Couldn't encrypt $name.age"
printf '%s\n' "Saved '$name' to the store." - git_add_and_commit "./$name.age" "add '$name'" + $git_enabled && git_add_and_commit "./$name.age" "add '$name'" } pw_edit() {@@ -75,7 +75,7 @@ die "Couldn't encrypt $name.age"
if $new; then printf '%s\n' "Saved '$name' to the store."; fi - git_add_and_commit "./$name.age" "edit '$name'" + $git_enabled && git_add_and_commit "./$name.age" "edit '$name'" } }@@ -85,7 +85,7 @@ rm -f "./$name.age"
rmdir -p "$(dirname "./$name")" 2>/dev/null || : - git_add_and_commit "./$name.age" "delete '$name'" + $git_enabled && git_add_and_commit "./$name.age" "delete '$name'" } }@@ -99,7 +99,11 @@ find . -type f -name \*.age | sed 's/..//;s/\.age$//' | sort
} git_add_and_commit() { - if $git_enabled; then git add "$1" && git commit -qm "$2"; fi + git add "$1" || + die "couldn't git add $1" + + git commit -qm "$2" || + die "couldn't git commit $2" } rand_chars() {