declare pwd="$(pwd)"
declare cmd="cd \"$(dirname "$file")\" && cd \"\$(git_root)\" && $*"
- cmd="$cmd && echo && echo user=\$(whoami) root=\$(pwd)"
+ cmd="$cmd && echo && echo user=\$(whoami) path=\$(pwd)"
if [ "$owner" != "$(id -un)" ]; then
su - "$owner" -c "$cmd"
else
declare default="${file##$(git_root)/}"
if [ -n "$(git status --porcelain "$file")" ]
then
- read -p "Your comment (default: $default): " comment
- [ -z "$comment" ] && comment="$default"
+ read -e -p "Your comment: " -i "$default" comment
+ if [ -z "$comment" ]
+ then
+ echo "Commit canceled because of empty comment!"
+ return 1
+ fi
git commit -m "$comment" "$file"
fi