whitespace and better git detection

This commit is contained in:
Lance Vick 2023-03-29 14:40:20 -07:00
parent f8427ccf2d
commit 8b5691dbc5
Signed by: lrvick
GPG Key ID: 8E47A1EC35A1551D
1 changed files with 11 additions and 10 deletions

9
sig
View File

@ -339,7 +339,7 @@ verify(){
local -r group="${2}" local -r group="${2}"
local -r ref=${3:-HEAD} local -r ref=${3:-HEAD}
local sig_count=0 seen_fps fp commit_sig tag_sigs note_sigs local sig_count=0 seen_fps fp commit_sig tag_sigs note_sigs
[ -d .git ] || [ -L .git ] || [ -f .git ] \ git rev-parse --git-dir >/dev/null 2>&1 \
|| die "Error: This folder is not a git repository" || die "Error: This folder is not a git repository"
if [[ $(git diff --stat) != '' ]]; then if [[ $(git diff --stat) != '' ]]; then
die "Error: git tree is dirty" die "Error: git tree is dirty"
@ -411,7 +411,7 @@ get_temp(){
## Add signed tag pointing at this commit. ## Add signed tag pointing at this commit.
## Optionally push to origin. ## Optionally push to origin.
sign_tag(){ sign_tag(){
[ -d '.git' ] \ git rev-parse --git-dir >/dev/null 2>&1 \
|| die "Not a git repository" || die "Not a git repository"
command -v git >/dev/null \ command -v git >/dev/null \
|| die "Git not installed" || die "Git not installed"
@ -431,7 +431,7 @@ sign_tag(){
## Add signed git note to this commit ## Add signed git note to this commit
## Optionally push to origin. ## Optionally push to origin.
sign_note() { sign_note() {
[ -d '.git' ] \ git rev-parse --git-dir >/dev/null 2>&1 \
|| die "Not a git repository" || die "Not a git repository"
command -v git >/dev/null \ command -v git >/dev/null \
|| die "Git not installed" || die "Git not installed"
@ -542,7 +542,8 @@ cmd_add(){
--) shift; break ;; --) shift; break ;;
esac done esac done
case $method in case $method in
git) sign_note "$push" ;; note) sign_note "$push" ;;
tag) sign_tag "$push" ;;
*) sign_note "$push" ;; *) sign_note "$push" ;;
esac esac
} }