2005-06-21 18:47:37 +02:00
|
|
|
#!/bin/sh
|
|
|
|
: ${GIT_DIR=.git}
|
|
|
|
old=$(git-rev-parse HEAD)
|
|
|
|
new=$(git-rev-parse --revs-only "$@")
|
|
|
|
new=${new:-$old}
|
|
|
|
args=($(git-rev-parse --no-revs "$@"))
|
|
|
|
|
|
|
|
i=0
|
2005-06-21 18:59:26 +02:00
|
|
|
force=
|
|
|
|
update=
|
2005-06-21 18:47:37 +02:00
|
|
|
while [ $i -lt ${#args} ]; do
|
|
|
|
case "${args[$i]}" in
|
|
|
|
"-f")
|
|
|
|
force=1;;
|
2005-06-21 18:59:26 +02:00
|
|
|
"-u")
|
|
|
|
update=1;;
|
2005-06-21 18:47:37 +02:00
|
|
|
"")
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "unknown flag ${args[$i]}"
|
|
|
|
exit 1;;
|
|
|
|
esac
|
|
|
|
i=$(($i+1))
|
|
|
|
done
|
|
|
|
|
2005-06-21 18:59:26 +02:00
|
|
|
if [ "$force" ]
|
2005-06-21 18:47:37 +02:00
|
|
|
then
|
|
|
|
git-read-tree --reset $new &&
|
2005-06-21 18:59:26 +02:00
|
|
|
git-checkout-cache -q -f -u -a
|
2005-06-21 18:47:37 +02:00
|
|
|
else
|
2005-06-21 18:59:26 +02:00
|
|
|
git-read-tree -m -u $old $new
|
|
|
|
fi && [ "$update" ] && echo $new > "$GIT_DIR/HEAD"
|
|
|
|
|