nix-prefetch-git: fix printing of revision

If the user explictly gives a ref such as "refs/heads/master", `git
rev-parse` failed because we only checked out the `fetchgit`
branch. Now, we also try `git rev-parse fetchgit` if the first call
fails, which fixes the issue.
This commit is contained in:
Benno Fünfstück 2014-06-11 14:09:58 +02:00
parent a46c4d976c
commit be25ce8f58

View File

@ -217,7 +217,7 @@ clone_user_rev() {
fi;; fi;;
esac esac
echo "git revision is $(cd $dir && git rev-parse $rev)" echo "git revision is $(cd $dir && (git rev-parse $rev 2> /dev/null || git rev-parse refs/heads/fetchgit) | tail -n1)"
# Allow doing additional processing before .git removal # Allow doing additional processing before .git removal
eval "$NIX_PREFETCH_GIT_CHECKOUT_HOOK" eval "$NIX_PREFETCH_GIT_CHECKOUT_HOOK"