]> git.nbdom.net Git - nb.git/commitdiff
gitf_publish
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 4 May 2023 20:31:00 +0000 (22:31 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 4 May 2023 20:31:00 +0000 (22:31 +0200)
etc/profile.d/git.sh

index db6de9d6ebdc7a5639ce10e039693a238dfa5546..f8f8c8db4031042982ef258fb8f8db1a63c8f9e8 100644 (file)
@@ -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