initial commit
This commit is contained in:
commit
243ce1b91d
34
config
Normal file
34
config
Normal file
|
@ -0,0 +1,34 @@
|
|||
[core]
|
||||
editor = nvim
|
||||
[init]
|
||||
defaultBranch = main
|
||||
[commit]
|
||||
gpgsign = true
|
||||
[filter "lfs"]
|
||||
required = true
|
||||
clean = git-lfs clean -- %f
|
||||
smudge = git-lfs smudge -- %f
|
||||
process = git-lfs filter-process
|
||||
[user]
|
||||
useConfigOnly = true
|
||||
|
||||
[alias]
|
||||
lg-inline = "log --graph --branches --all --date=human --color --format='%C(bold dim green)%h%C(auto) - %C(yellow)%<(12)%cr %C(bold)→%C(reset) %s%C(dim white) - %an %C(bold green)<sig>%G?</sig>%GS%C(reset cyan)%d%C(reset)'"
|
||||
# sed part courtesy of: https://stackoverflow.com/a/32038784
|
||||
lg = "!f() { \
|
||||
git lg-inline $@ |\
|
||||
sed \
|
||||
-e 's#<sig>G</sig>#Good Signature: #' \
|
||||
-e 's#<sig>B</sig>#\\x1b[31mBAD#' \
|
||||
-e 's#<sig>U</sig>#\\x1b[33mUnknown Trust: #' \
|
||||
-e 's#<sig>X</sig>#Good | Expired#' \
|
||||
-e 's#<sig>Y</sig>#\\x1b[33mExpired Key#' \
|
||||
-e 's#<sig>R</sig>#\\x1b[31mRevoked#' \
|
||||
-e 's#<sig>E</sig>#\\x1b[33mMissing Key#' \
|
||||
-e 's#<sig>N</sig>##' | \
|
||||
less -cr; \
|
||||
}; f"
|
||||
ck = "checkout"
|
||||
s = "status"
|
||||
# https://www.micah.soy/posts/setting-up-git-identities/
|
||||
identity = "!~/.config/git/scripts/identity.sh"
|
43
scripts/identity.sh
Executable file
43
scripts/identity.sh
Executable file
|
@ -0,0 +1,43 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "USAGE:";
|
||||
echo " git identity <gpg key id>";
|
||||
echo;
|
||||
|
||||
echo "current identity:";
|
||||
echo " name = $(git config user.name)";
|
||||
echo " email = $(git config user.email)";
|
||||
echo " key = $(git config user.signingKey)";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
uid_regex="([^\(]*)\s*(\((.*)\))?\s*<(.*)>";
|
||||
|
||||
uid=$(gpg --with-colons -K $1 | awk -F: '$1=="uid" {print $10; exit}');
|
||||
|
||||
if [ -z "$uid" ]; then
|
||||
echo "ERROR: found no gpg key matching this";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
name=$(printf "$uid" | sed --regexp-extended -e "s/$uid_regex/\1/");
|
||||
email=$(printf "$uid" | sed --regexp-extended -e "s/$uid_regex/\4/");
|
||||
|
||||
echo "using this identity:";
|
||||
echo " name = $name";
|
||||
echo " email = $email";
|
||||
|
||||
git config --local user.name "$name"
|
||||
git config --local user.email "$email"
|
||||
|
||||
keyid=$(gpg -K --with-colon $1 | awk -F: '$12~/.*s.*/ {print $5; exit}');
|
||||
# TODO: if multiple found, bring up a dialog to select the right key
|
||||
|
||||
if [ -z "$keyid" ]; then
|
||||
echo "WARNING: found no subkey with signing capabilities. No signing key will be set";
|
||||
git config --local --unset user.signingKey;
|
||||
else
|
||||
echo " key = $keyid";
|
||||
git config --local user.signingKey "$keyid";
|
||||
fi
|
Loading…
Reference in a new issue