You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#!/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
|
|
|
|
force=
|
|
|
|
update=
|
|
|
|
while [ $i -lt ${#args} ]; do
|
|
|
|
case "${args[$i]}" in
|
|
|
|
"-f")
|
|
|
|
force=1;;
|
|
|
|
"-u")
|
|
|
|
update=1;;
|
|
|
|
"")
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "unknown flag ${args[$i]}"
|
|
|
|
exit 1;;
|
|
|
|
esac
|
|
|
|
i=$(($i+1))
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "$force" ]
|
|
|
|
then
|
|
|
|
git-read-tree --reset $new &&
|
|
|
|
git-checkout-cache -q -f -u -a
|
|
|
|
else
|
|
|
|
git-read-tree -m -u $old $new
|
|
|
|
fi && [ "$update" ] && echo $new > "$GIT_DIR/HEAD"
|
|
|
|
|