mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
fetchgit: add lfs support
This commit is contained in:
parent
ecf84de70c
commit
741285611f
@ -8,6 +8,7 @@ header "exporting $url (rev $rev) into $out"
|
||||
|
||||
$SHELL $fetcher --builder --url "$url" --out "$out" --rev "$rev" \
|
||||
${leaveDotGit:+--leave-dotGit} \
|
||||
${fetchLFS:+--fetch-lfs} \
|
||||
${deepClone:+--deepClone} \
|
||||
${fetchSubmodules:+--fetch-submodules} \
|
||||
${branchName:+--branch-name "$branchName"}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{stdenvNoCC, git, cacert}: let
|
||||
{stdenvNoCC, git, git-lfs, cacert}: let
|
||||
urlToName = url: rev: let
|
||||
inherit (stdenvNoCC.lib) removeSuffix splitString last;
|
||||
base = last (splitString ":" (baseNameOf (removeSuffix "/" url)));
|
||||
@ -20,6 +20,7 @@ in
|
||||
# successfully. This can do things like check or transform the file.
|
||||
postFetch ? ""
|
||||
, preferLocalBuild ? true
|
||||
, fetchLFS ? false
|
||||
}:
|
||||
|
||||
/* NOTE:
|
||||
@ -53,13 +54,15 @@ stdenvNoCC.mkDerivation {
|
||||
inherit name;
|
||||
builder = ./builder.sh;
|
||||
fetcher = ./nix-prefetch-git; # This must be a string to ensure it's called with bash.
|
||||
nativeBuildInputs = [git];
|
||||
|
||||
nativeBuildInputs = [ git ]
|
||||
++ stdenvNoCC.lib.optionals fetchLFS [ git-lfs ];
|
||||
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash = sha256;
|
||||
|
||||
inherit url rev leaveDotGit fetchSubmodules deepClone branchName postFetch;
|
||||
inherit url rev leaveDotGit fetchLFS fetchSubmodules deepClone branchName postFetch;
|
||||
|
||||
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||
|
||||
|
@ -9,6 +9,7 @@ hashType=$NIX_HASH_ALGO
|
||||
deepClone=$NIX_PREFETCH_GIT_DEEP_CLONE
|
||||
leaveDotGit=$NIX_PREFETCH_GIT_LEAVE_DOT_GIT
|
||||
fetchSubmodules=
|
||||
fetchLFS=
|
||||
builder=
|
||||
branchName=$NIX_PREFETCH_GIT_BRANCH_NAME
|
||||
|
||||
@ -72,6 +73,7 @@ for arg; do
|
||||
--quiet) QUIET=true;;
|
||||
--no-deepClone) deepClone=;;
|
||||
--leave-dotGit) leaveDotGit=true;;
|
||||
--fetch-lfs) fetchLFS=true;;
|
||||
--fetch-submodules) fetchSubmodules=true;;
|
||||
--builder) builder=true;;
|
||||
-h|--help) usage; exit;;
|
||||
@ -283,6 +285,11 @@ clone_user_rev() {
|
||||
local url="$2"
|
||||
local rev="${3:-HEAD}"
|
||||
|
||||
if [ -n "$fetchLFS" ]; then
|
||||
HOME=$TMPDIR
|
||||
git lfs install
|
||||
fi
|
||||
|
||||
# Perform the checkout.
|
||||
case "$rev" in
|
||||
HEAD|refs/*)
|
||||
|
Loading…
Reference in New Issue
Block a user