2009-06-24 14:48:01 +02:00
|
|
|
source $stdenv/setup
|
|
|
|
|
|
|
|
header "exporting $url (rev $rev) into $out"
|
|
|
|
|
2011-04-27 05:00:47 +02:00
|
|
|
git init $out
|
|
|
|
cd $out
|
|
|
|
git remote add origin "$url"
|
|
|
|
git fetch origin
|
|
|
|
git remote set-head origin -a
|
2010-05-19 23:27:01 +02:00
|
|
|
|
2011-04-27 05:00:47 +02:00
|
|
|
# If no revision was specified, the remote HEAD will be used
|
|
|
|
git checkout -b __nixos_build__ origin/HEAD
|
2010-05-19 23:27:01 +02:00
|
|
|
|
2011-04-27 05:00:47 +02:00
|
|
|
if test -n "$rev"; then
|
|
|
|
echo "Trying to checkout: $rev"
|
|
|
|
parsed_rev=$(
|
|
|
|
git rev-parse --verify "$rev" 2>/dev/null ||
|
|
|
|
git rev-parse --verify origin/"$rev" 2>/dev/null
|
|
|
|
)
|
|
|
|
git reset --hard $parsed_rev
|
2009-06-24 14:48:01 +02:00
|
|
|
fi
|
|
|
|
|
2010-01-27 13:12:35 +01:00
|
|
|
if test -z "$leaveDotGit"; then
|
|
|
|
find $out -name .git\* | xargs rm -rf
|
|
|
|
fi
|
2009-06-24 14:48:01 +02:00
|
|
|
|
2010-01-27 13:12:35 +01:00
|
|
|
stopNest
|