[PATCH] Make get_sha1_basic() more careful
[git/gitweb.git] / git-reset-script
blob49994df7a2329a87a65588be94088198d208ba1a
1 #!/bin/sh
2 . git-sh-setup-script || die "Not a git archive"
3 rev=$(git-rev-parse --revs-only --verify --default HEAD "$@") || exit
4 rev=$(git-rev-parse --revs-only --verify $rev^0) || exit
5 git-read-tree --reset "$rev" && {
6 if orig=$(git-rev-parse --verify HEAD 2>/dev/null)
7 then
8 echo "$orig" >"$GIT_DIR/ORIG_HEAD"
9 fi
10 echo "$rev" > "$GIT_DIR/HEAD"
12 git-update-cache --refresh
13 rm -f "$GIT_DIR/MERGE_HEAD"