vanadium/git: generate git conditional config for both https and git

This commit is contained in:
Primrose 2025-07-31 23:57:05 +02:00
parent bdf7dd7122
commit 4cc165fd7f
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -41,8 +41,13 @@
];
};
includes = let
hasconfigRemoteCondition = cfg:
cfg // {condition = "hasconfig:remote.*.url:" + cfg.condition;};
hasconfigRemoteCondition = cfg: let
cfg' = builtins.removeAttrs cfg ["url" "path"];
path = cfg.path or "*/**";
in [
(cfg' // {condition = "hasconfig:remote.*.url:git@${cfg.url}:${path}";})
(cfg' // {condition = "hasconfig:remote.*.url:https://${cfg.url}/${path}";})
];
haskellIdentity = {
init.defaultBranch = "main";
@ -62,30 +67,33 @@
blame.ignoreRevsFile = ".git-blame-ignore-revs";
};
in
map hasconfigRemoteCondition [
builtins.concatMap hasconfigRemoteCondition [
# Univ stuff
{
condition = "git@gitlab.istic.univ-rennes1.fr";
url = "gitlab.istic.univ-rennes1.fr";
contents = universityIdentity;
}
{
condition = "git@gitlab2.istic.univ-rennes1.fr";
url = "gitlab2.istic.univ-rennes1.fr";
contents = universityIdentity;
}
# Haskell
{
condition = "git@gitlab.haskell.org:*/**";
contents = lib.mkMerge [
haskellIdentity
blameIgnore
];
url = "gitlab.haskell.org";
contents = haskellIdentity;
}
# Blame
# Turning this on globally will fail if the file doesn't exist
{
condition = "git@github.com:nixos/nixpkgs.git";
url = "github.com";
path = "nixos/nixpkgs.git";
contents = blameIgnore;
}
{
url = "gitlab.haskell.org";
path = "ghc/ghc.git";
contents = blameIgnore;
}
];