mirror of
https://github.com/arcan1s/dotfiles.git
synced 2025-05-01 11:07:18 +00:00
Compare commits
2 Commits
fa07319ff6
...
55efbbe443
Author | SHA1 | Date | |
---|---|---|---|
55efbbe443 | |||
0b68f6c2e7 |
@ -1,72 +0,0 @@
|
|||||||
!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Patterns to match a repo's "remote.origin.url"
|
|
||||||
git_remotes[0]="github"
|
|
||||||
git_remotes[1]="bitbucket"
|
|
||||||
|
|
||||||
local_id_0[0]="Evgeniy Alekseev"
|
|
||||||
local_id_0[1]="darkarcanis@mail.ru"
|
|
||||||
|
|
||||||
local_id_1[0]="Evgeniy Alekseev"
|
|
||||||
local_id_1[1]="ea@exante.eu"
|
|
||||||
|
|
||||||
local_fallback_id[0]="${local_id_0[0]}"
|
|
||||||
local_fallback_id[1]="${local_id_0[1]}"
|
|
||||||
|
|
||||||
|
|
||||||
setIdentity() {
|
|
||||||
local current_id local_id
|
|
||||||
|
|
||||||
current_id[0]="$(git config --get --local user.name)"
|
|
||||||
current_id[1]="$(git config --get --local user.email)"
|
|
||||||
local_id=("$@")
|
|
||||||
|
|
||||||
if [[ "${current_id[0]}" == "${local_id[0]}" &&
|
|
||||||
"${current_id[1]}" == "${local_id[1]}" ]]; then
|
|
||||||
printf " Local identity is:\n"
|
|
||||||
printf "» User: %s\n» Mail: %s\n\n" "${current_id[@]}"
|
|
||||||
else
|
|
||||||
printf "» User: %s\n» Mail: %s\n\n" "${local_id[@]}"
|
|
||||||
git config --local user.name "${local_id[0]}"
|
|
||||||
git config --local user.email "${local_id[1]}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
current_remote_url="$(git config --get --local remote.origin.url)"
|
|
||||||
|
|
||||||
if [[ "$current_remote_url" ]]; then
|
|
||||||
for service in "${git_remotes[@]}"; do
|
|
||||||
# Disable case sensitivity for regex matching
|
|
||||||
shopt -s nocasematch
|
|
||||||
if [[ "$current_remote_url" =~ $service ]]; then
|
|
||||||
case "$service" in
|
|
||||||
"${git_remotes[0]}" )
|
|
||||||
printf "\n»» An Intermission\n» %s repository found." "${git_remotes[0]}"
|
|
||||||
setIdentity "${local_id_0[@]}"
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
"${git_remotes[1]}" )
|
|
||||||
printf "\n»» An Intermission\n» %s repository found." "${git_remotes[1]}"
|
|
||||||
setIdentity "${local_id_1[@]}"
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
* )
|
|
||||||
printf "\n» pre-commit hook: unknown error\n» Quitting.\n"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
else
|
|
||||||
printf "\n»» An Intermission\n» No remote repository set. Using local fallback identity:\n"
|
|
||||||
printf "» User: %s\n» Mail: %s\n\n" "${local_fallback_id[@]}"
|
|
||||||
# Get the user's attention for a second
|
|
||||||
sleep 1
|
|
||||||
git config --local user.name "${local_fallback_id[0]}"
|
|
||||||
git config --local user.email "${local_fallback_id[1]}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit 0
|
|
@ -1,8 +1,6 @@
|
|||||||
[user]
|
[user]
|
||||||
name = Evgenii Alekseev
|
name = Evgenii Alekseev
|
||||||
email = i@arcanis.me
|
email = i@arcanis.me
|
||||||
[init]
|
|
||||||
templatedir = ~/.git/templates
|
|
||||||
[core]
|
[core]
|
||||||
autocrlf = false
|
autocrlf = false
|
||||||
safecrlf = false
|
safecrlf = false
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Include = /etc/pacaur.conf
|
Include = /etc/pacaur.conf
|
||||||
|
|
||||||
[arcanisrepo]
|
[arcanisrepo]
|
||||||
Server = http://repo.arcanis.me/$arch
|
Server = https://repo.arcanis.me/$arch
|
||||||
SigLevel = DatabaseRequired PackageNever TrustedOnly
|
SigLevel = DatabaseRequired PackageNever TrustedOnly
|
||||||
|
|
||||||
[blackarch]
|
[blackarch]
|
||||||
|
Loading…
Reference in New Issue
Block a user