From d737929b9e833f76a2b5e967ee60352b830e146b Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 21 Jan 2015 13:43:00 +0000 Subject: [PATCH] git-tools: detect options not needing commit message edition --- rc/git-tools.kak | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rc/git-tools.kak b/rc/git-tools.kak index bd762370..3f86c453 100644 --- a/rc/git-tools.kak +++ b/rc/git-tools.kak @@ -111,6 +111,18 @@ def -shell-params \ } commit() { + # Handle case where message needs not to be edited + if grep -E -q -e "-m|-F|-C|--message=.*|--file=.*|--reuse-message=.*|--no-edit"; then + if git commit "$@" > /dev/null 2>&1; then + echo 'echo -color Information Commit succeeded' + else + echo 'echo -color Error Commit failed' + fi + exit + fi <<-EOF + $@ + EOF + # fails, and generate COMMIT_EDITMSG GIT_EDITOR='' EDITOR='' git commit > /dev/null 2>&1 msgfile="$(git rev-parse --git-dir)/COMMIT_EDITMSG"