summaryrefslogtreecommitdiff
path: root/pkgs/build-support/fetchgit/builder.sh
blob: b4c2f67830b17dd4c57fda77726257ab0a1b6845 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# tested so far with:
# - no revision specified and remote has a HEAD which is used
# - revision specified and remote has a HEAD
# - revision specified and remote without HEAD
#

source "$NIX_ATTRS_SH_FILE"

echo "exporting $url (rev $rev) into $out"

runHook preFetch

if [ -n "$gitConfigFile" ]; then
  echo "using GIT_CONFIG_GLOBAL=$gitConfigFile"
  export GIT_CONFIG_GLOBAL="$gitConfigFile"
fi

$SHELL $fetcher --builder --url "$url" --out "$out" --rev "$rev" --name "$name" \
  ${leaveDotGit:+--leave-dotGit} \
  ${fetchLFS:+--fetch-lfs} \
  ${deepClone:+--deepClone} \
  ${fetchSubmodules:+--fetch-submodules} \
  ${fetchTags:+--fetch-tags} \
  ${sparseCheckoutText:+--sparse-checkout "$sparseCheckoutText"} \
  ${nonConeMode:+--non-cone-mode} \
  ${branchName:+--branch-name "$branchName"} \
  ${rootDir:+--root-dir "$rootDir"}

runHook postFetch