Set Git identity per directory
This commit is contained in:
parent
23688c96d5
commit
eec9bc3c71
2 changed files with 22 additions and 1 deletions
|
|
@ -98,6 +98,10 @@
|
|||
|
||||
# fix too dark color on solarized theme
|
||||
set -g fish_color_autosuggestion brgreen
|
||||
|
||||
if type -q fish_set_git_author_by_pwd
|
||||
fish_set_git_author_by_pwd
|
||||
end
|
||||
'';
|
||||
|
||||
functions = {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
{ nixosConfig, pkgs, ... }:
|
||||
|
||||
let
|
||||
identity.DigitalerDienst = {
|
||||
name = "Jakob Lechner";
|
||||
email = "j.lechner@digitaler-dienst.gmbh";
|
||||
};
|
||||
in
|
||||
{
|
||||
programs = {
|
||||
git = {
|
||||
|
|
@ -157,6 +162,18 @@
|
|||
end
|
||||
'';
|
||||
};
|
||||
"fish_set_git_author_by_pwd" = {
|
||||
description = "Set Git identity by PWD";
|
||||
body = ''
|
||||
if string match -n $HOME'/digitaler-dienst/*' $PWD/ > /dev/null
|
||||
if git rev-parse --git-dir >/dev/null 2>&1
|
||||
git config --local user.name >/dev/null || git config --local user.name "${identity.DigitalerDienst.name}"
|
||||
git config --local user.email >/dev/null || git config --local user.email "${identity.DigitalerDienst.email}"
|
||||
end
|
||||
end
|
||||
'';
|
||||
onVariable = "PWD";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue