nix-prefetch-git: unbreak JSON output

This fixes a regression caused by commit f56ab9e
("nix-prefetch-git: Include the date in the machine-readable [...]")
where a couple of directory paths printed by pushd/popd appeared before
the JSON output on stdout (thus breaking it). Fix it by redirecting the
extraneous output to /dev/null.

Reported by Michael Alan Dorman <mdorman@ironicdesign.com>.
This commit is contained in:
Bjørn Forsman 2016-07-04 14:34:24 +02:00
parent 03fcbf6317
commit 68205d0ade

View File

@ -288,12 +288,12 @@ _clone_user_rev() {
fi;;
esac
pushd "$dir"
pushd "$dir" >/dev/null
fullRev=$( (git rev-parse "$rev" 2>/dev/null || git rev-parse "refs/heads/$branchName") | tail -n1)
humanReadableRev=$(git describe "$fullRev" 2> /dev/null || git describe --tags "$fullRev" 2> /dev/null || echo -- none --)
commitDate=$(git show --no-patch --pretty=%ci "$fullRev")
commitDateStrict8601=$(git show --no-patch --pretty=%cI "$fullRev")
popd
popd >/dev/null
# Allow doing additional processing before .git removal
eval "$NIX_PREFETCH_GIT_CHECKOUT_HOOK"