git-commit-vandalism/git-reset-script
Junio C Hamano 2ad77e67c7 Audit rev-parse users.
Make sure that we say --verify when we want to get a single SHA1
name.  Also when we say --verify, --revs-only is redundant.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-15 15:37:37 -07:00

14 lines
383 B
Bash
Executable File

#!/bin/sh
. git-sh-setup-script || die "Not a git archive"
rev=$(git-rev-parse --verify --default HEAD "$@") || exit
rev=$(git-rev-parse --verify $rev^0) || exit
git-read-tree --reset "$rev" && {
if orig=$(git-rev-parse --verify HEAD 2>/dev/null)
then
echo "$orig" >"$GIT_DIR/ORIG_HEAD"
fi
echo "$rev" > "$GIT_DIR/HEAD"
}
git-update-cache --refresh
rm -f "$GIT_DIR/MERGE_HEAD"