2011-06-22 15:34:27 -04:00
|
|
|
# tested so far with:
|
|
|
|
# - no revision specified and remote has a HEAD which is used
|
|
|
|
# - revision specified and remote has a HEAD
|
2011-06-22 17:01:36 -04:00
|
|
|
# - revision specified and remote without HEAD
|
2009-06-24 08:48:01 -04:00
|
|
|
source $stdenv/setup
|
|
|
|
|
|
|
|
header "exporting $url (rev $rev) into $out"
|
|
|
|
|
2011-04-26 23:00:47 -04:00
|
|
|
git init $out
|
|
|
|
cd $out
|
|
|
|
git remote add origin "$url"
|
2011-06-22 15:34:32 -04:00
|
|
|
git fetch --progress origin
|
2011-06-22 15:34:27 -04:00
|
|
|
git remote set-head origin -a || (
|
2011-06-22 19:33:41 -04:00
|
|
|
test -n "$rev" && echo "that's ok, we want $rev" || exit 1)
|
2010-05-19 17:27:01 -04:00
|
|
|
|
2011-04-26 23:00:47 -04: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
|
2011-06-22 15:34:27 -04:00
|
|
|
git checkout -b __nixos_build__
|
|
|
|
else
|
|
|
|
git checkout -b __nixos_build__ origin/HEAD
|
2009-06-24 08:48:01 -04:00
|
|
|
fi
|
|
|
|
|
2010-01-27 07:12:35 -05:00
|
|
|
if test -z "$leaveDotGit"; then
|
|
|
|
find $out -name .git\* | xargs rm -rf
|
|
|
|
fi
|
2009-06-24 08:48:01 -04:00
|
|
|
|
2010-01-27 07:12:35 -05:00
|
|
|
stopNest
|