fetchgit: Implement option to not check out submodules.

This commit is contained in:
ambrop7@gmail.com 2014-03-23 17:19:39 +01:00
parent ae8a8b5deb
commit 3a765a7309
3 changed files with 11 additions and 4 deletions

View File

@ -6,6 +6,8 @@ source $stdenv/setup
header "exporting $url (rev $rev) into $out"
$fetcher --builder --url "$url" --out "$out" --rev "$rev" ${leaveDotGit:+--leave-dotGit}
$fetcher --builder --url "$url" --out "$out" --rev "$rev" \
${leaveDotGit:+--leave-dotGit} \
${fetchSubmodules:+--fetch-submodules}
stopNest

View File

@ -1,5 +1,5 @@
{stdenv, git, cacert}:
{url, rev ? "HEAD", md5 ? "", sha256 ? "", leaveDotGit ? false }:
{url, rev ? "HEAD", md5 ? "", sha256 ? "", leaveDotGit ? false, fetchSubmodules ? true}:
/* NOTE:
fetchgit has one problem: git fetch only works for refs.
@ -35,7 +35,7 @@ stdenv.mkDerivation {
outputHashMode = "recursive";
outputHash = if sha256 == "" then md5 else sha256;
inherit url rev leaveDotGit;
inherit url rev leaveDotGit fetchSubmodules;
GIT_SSL_CAINFO = "${cacert}/etc/ca-bundle.crt";

View File

@ -6,6 +6,7 @@ expHash=
hashType=$NIX_HASH_ALGO
deepClone=$NIX_PREFETCH_GIT_DEEP_CLONE
leaveDotGit=$NIX_PREFETCH_GIT_LEAVE_DOT_GIT
fetchSubmodules=
builder=
if test -n "$deepClone"; then
@ -33,6 +34,7 @@ for arg; do
--deepClone) deepClone=true;;
--no-deepClone) deepClone=false;;
--leave-dotGit) leaveDotGit=true;;
--fetch-submodules) fetchSubmodules=true;;
--builder) builder=true;;
*)
argi=$(($argi + 1))
@ -66,6 +68,7 @@ Options:
--deepClone Clone submodules recursively.
--no-deepClone Do not clone submodules.
--leave-dotGit Keep the .git directories.
--fetch-submodules Fetch submodules.
--builder Clone as fetchgit does, but url, rev, and out option are mandatory.
"
exit 1
@ -178,7 +181,9 @@ clone(){
)
# Checkout linked sources.
if test -n "$fetchSubmodules"; then
init_submodules;
fi
if [ -z "$builder" -a -f .topdeps ]; then
if tg help 2>&1 > /dev/null