mirror of
https://cgit.krebsco.de/krops
synced 2024-11-23 11:39:48 +01:00
populate git: add fetchAlways option
This commit is contained in:
parent
14a54637ce
commit
8f44460003
2 changed files with 10 additions and 2 deletions
|
@ -81,6 +81,10 @@
|
||||||
type = lib.types.listOf lib.types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
fetchAlways = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
ref = lib.mkOption {
|
ref = lib.mkOption {
|
||||||
type = lib.types.str; # TODO lib.types.git.ref
|
type = lib.types.str; # TODO lib.types.git.ref
|
||||||
};
|
};
|
||||||
|
|
|
@ -66,9 +66,13 @@ let
|
||||||
hash=${quote source.ref}
|
hash=${quote source.ref}
|
||||||
|
|
||||||
if ! test "$(git log --format=%H -1)" = "$hash"; then
|
if ! test "$(git log --format=%H -1)" = "$hash"; then
|
||||||
|
${if source.fetchAlways then /* sh */ ''
|
||||||
|
git fetch origin
|
||||||
|
'' else /* sh */ ''
|
||||||
if ! git log -1 "$hash" >/dev/null 2>&1; then
|
if ! git log -1 "$hash" >/dev/null 2>&1; then
|
||||||
git fetch origin
|
git fetch origin
|
||||||
fi
|
fi
|
||||||
|
''}
|
||||||
git reset --hard "$hash" >&2
|
git reset --hard "$hash" >&2
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue