git-utils/bin/git-chmod
Alex A. Naanou 7f90305705 chmod +x git-chmod -- how ironic =)
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2024-02-14 20:06:31 +03:00

46 lines
738 B
Bash
Executable File

#!/usr/bin/bash
while true ; do
case $1 in
-h|--help)
echo "Usage: $(basename "$0") MODE FILE ..."
echo
echo "Change file mode on file(s)."
echo
echo "Options:"
echo " -h --help - print this message and exit"
echo
echo "This is equivalent to:"
echo " $ git update-index --chmod=MODE FILE ..."
echo
echo "This is useful in default configurations of git on Windows."
echo
exit
;;
-*|--*)
echo "Error: unknown option: \"$1\"" >&2
exit
;;
*)
break
;;
esac
done
if [[ $# < 2 ]] ; then
echo "Error need at least two arguments."
exit 1
fi
MODE=$1
shift
git update-index --chmod="$MODE" "$@"
# vim:set sw=4 ts=4 :