From 008e50d310e5a6555c6b13ec3fdfcf72eaf6c0e2 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Thu, 4 May 2023 22:31:00 +0200 Subject: [PATCH] gitf_publish --- etc/profile.d/git.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/etc/profile.d/git.sh b/etc/profile.d/git.sh index db6de9d6..f8f8c8db 100644 --- a/etc/profile.d/git.sh +++ b/etc/profile.d/git.sh @@ -36,7 +36,7 @@ EOF 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 @@ -73,8 +73,12 @@ EOF 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 -- 2.47.3