Merge pull request #2010 from ambrop72/fetchgit-no-submodules

fetchgit: Implement option to not check out submodules.
This commit is contained in:
Peter Simons 2014-03-26 11:11:25 +01:00
commit 903df21f65
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.
init_submodules;
if test -n "$fetchSubmodules"; then
init_submodules;
fi
if [ -z "$builder" -a -f .topdeps ]; then
if tg help 2>&1 > /dev/null