Use git-update-ref in scripts.

This uses the git-update-ref command in scripts for safer updates.
Also places where we used to read HEAD ref by using "cat" were fixed
to use git-rev-parse.  This will matter when we start using symbolic
references.

Signed-off-by: Junio C Hamano <junkio@cox.net>
diff --git a/git-reset.sh b/git-reset.sh
index dfa9cb8..f9995ca 100755
--- a/git-reset.sh
+++ b/git-reset.sh
@@ -60,7 +60,7 @@
 else
 	rm -f "$GIT_DIR/ORIG_HEAD"
 fi
-echo "$rev" >"$GIT_DIR/HEAD"
+git-update-ref HEAD "$rev"
 
 case "$reset_type" in
 --hard )