Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions pkgs/build-support/fetchgit/nix-prefetch-git
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#! /bin/sh -e

url=$1
rev=$2
expHash=$3
url=
rev=
expHash=
hashType=$NIX_HASH_ALGO
deepClone=$NIX_PREFETCH_GIT_DEEP_CLONE
leaveDotGit=$NIX_PREFETCH_GIT_LEAVE_DOT_GIT
Expand Down Expand Up @@ -189,21 +189,19 @@ clone(){
clone_user_rev() {
local dir="$1"
local url="$2"
local rev="$3"
local rev="${3:-HEAD}"

# Perform the checkout.
case "$rev" in
HEAD|refs/*)
clone "$dir" "$url" "" "$rev" 1>&2;;
[0-9a-f]*)
*)
if test -z "$(echo $rev | tr -d 0123456789abcdef)"; then
clone "$dir" "$url" "$rev" "" 1>&2;
else
echo 1>&2 "Bad commit hash or bad reference.";
exit 1;
fi;;
"")
clone "$dir" "$url" "" "HEAD" 1>&2;;
esac

# Allow doing additional processing before .git removal
Expand Down