···
branchName=$NIX_PREFETCH_GIT_BRANCH_NAME
15
+
# populated by clone_user_rev()
if test -n "$deepClone"; then
···
--hash) argfun=set_hashType;;
--branch-name) argfun=set_branchName;;
--deepClone) deepClone=true;;
60
+
--quiet) QUIET=true;;
--no-deepClone) deepClone=false;;
--leave-dotGit) leaveDotGit=true;;
--fetch-submodules) fetchSubmodules=true;;
···
263
+
_clone_user_rev() {
···
275
-
local full_revision=$(cd $dir && (git rev-parse $rev 2> /dev/null || git rev-parse refs/heads/$branchName) | tail -n1)
276
-
echo "git revision is $full_revision"
277
-
echo "git human-readable version is $(cd $dir && (git describe $full_revision 2> /dev/null || git describe --tags $full_revision 2> /dev/null || echo -- none --))" >&2
278
-
echo "Commit date is $(cd $dir && git show --no-patch --pretty=%ci $full_revision)"
281
+
fullRev="$(cd $dir && (git rev-parse $rev 2> /dev/null || git rev-parse refs/heads/$branchName) | tail -n1)"
282
+
humanReadableRev="$(cd $dir && (git describe $fullRev 2> /dev/null || git describe --tags $fullRev 2> /dev/null || echo -- none --))"
283
+
commitDate="$(cd $dir && git show --no-patch --pretty=%ci $fullRev)"
# Allow doing additional processing before .git removal
eval "$NIX_PREFETCH_GIT_CHECKOUT_HOOK"
if test -z "$leaveDotGit"; then
echo "removing \`.git'..." >&2
284
-
find $dir -name .git\* | xargs rm -rf
289
+
find "$dir" -name .git\* -print0 | xargs -0 rm -rf
286
-
find $dir -name .git | while read gitdir; do
291
+
find "$dir" -name .git | while read gitdir; do
make_deterministic_repo "$(readlink -f "$gitdir/..")"
298
+
if ! test -n "$QUIET"; then
299
+
_clone_user_rev "$@"
301
+
errfile="$(mktemp "${TMPDIR:-/tmp}/git-checkout-err-XXXXXXXX")"
302
+
trap "rm -rf \"$errfile\"" EXIT
303
+
_clone_user_rev "$@" 2> "$errfile" || (
314
+
if ! test -n "$QUIET"; then
316
+
echo "git revision is $fullRev" >&2
317
+
if test -n "$finalPath"; then
318
+
echo "path is $finalPath" >&2
320
+
echo "git human-readable version is $humanReadableRev" >&2
321
+
echo "Commit date is $commitDate" >&2
322
+
if test -n "$hash"; then
323
+
echo "hash is $hash" >&2
326
+
if test -n "$hash"; then
328
+
echo " url = \"$url\";"
329
+
echo " rev = \"$fullRev\";"
330
+
echo " $hashType = \"$hash\";"
if test -z "$branchName"; then
···
hash=$(nix-hash --type $hashType --base32 $tmpFile)
330
-
if ! test -n "$QUIET"; then echo "hash is $hash" >&2; fi
# Add the downloaded file to the Nix store.
finalPath=$(nix-store --add-fixed --recursive "$hashType" "$tmpFile")
if test -n "$expHash" -a "$expHash" != "$hash"; then
336
-
echo "hash mismatch for URL \`$url'"
379
+
echo "hash mismatch for URL \`$url'" >&2
341
-
if ! test -n "$QUIET"; then echo "path is $finalPath" >&2; fi
384
+
print_results "$hash"
if test -n "$PRINT_PATH"; then