Load git config from nix

This commit is contained in:
Manuel Thalmann 2024-07-15 20:24:47 +02:00
parent abad516efc
commit 5cb1026fc2

View file

@ -1,8 +1,12 @@
#!/bin/env fish #!/bin/env fish
begin begin
set -l dir (status dirname)
source "$(status dirname)/../../Scripts/software.fish" source "$(status dirname)/../../Scripts/software.fish"
function configureSW -S function configureSW -S -V dir
source "$dir/../../Scripts/config.fish"
set -l branch "valhalla.git.defaultBranch"
function setConfig function setConfig
sudo git config --system $argv sudo git config --system $argv
end end
@ -19,46 +23,41 @@ begin
pushd "$dir" > /dev/null pushd "$dir" > /dev/null
begin begin
set -l key valhalla.git.flow
set -l mainKey "$key.mainBranch"
set -l devKey "$key.devBranch"
git init git init
git commit --allow-empty -m "Initial commit" > /dev/null git commit --allow-empty -m "Initial commit" > /dev/null
git branch master || true &> /dev/null git branch master || true &> /dev/null
git branch main || true &> /dev/null git branch main || true &> /dev/null
git branch dev || true &> /dev/null git branch dev || true &> /dev/null
yes "" | git flow init &> /dev/null yes "" | git flow init &> /dev/null
sudo git flow config set --system master main > /dev/null
sudo git flow config set --system develop dev > /dev/null if isSet "$mainKey"
sudo git flow config set --system master (getConfig "$mainKey") > /dev/null
else
true
end
if isSet "$devKey"
sudo git flow config set --system develop (getConfig "$devKey") > /dev/null
else
true
end
end end
popd > /dev/null popd > /dev/null
rm -rf "$dir" rm -rf "$dir"
end end
setConfig alias.ahfange init begin # Aliases
setConfig alias.tuedezue add set -l key valhalla.git.aliases
setConfig alias.beschuldig blame set -l aliases (getConfig "$key" --json)
setConfig alias.zieh pull
setConfig alias.druck push for name in (echo "$aliases" | jq 'keys[]' --raw-output0 | string split0)
setConfig alias.machnah clone setConfig "alias.$name" (getConfig "$key.$name")
setConfig alias.hol fetch end
setConfig alias.zwiigab branch end
setConfig alias.buechiih commit
setConfig alias.eich rebase
setConfig alias.erd rebase
setConfig alias.gahufwiifelde rebase
setConfig alias.vergliich diff
setConfig alias.tuezemme merge
setConfig alias.versorg stash
setConfig alias.markier tag
setConfig alias.pflueckoepfel cherry-pick
setConfig alias.pflueckhimbeeri cherry-pick
setConfig alias.buechuus checkout
setConfig alias.quaetsch 'merge --squash'
setConfig alias.pfudle 'push --force'
setConfig alias.beschuldigung blame
setConfig alias.zwiigli branch
setConfig alias.tagebuech log
setConfig alias.versteck stash
setConfig alias.zuestand status
setConfig alias.markierig tag
end end
end end