git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 1/2] git-gui: warn if the commit message contains lines longer than the set limit
@ 2019-09-04 20:10 Bert Wesarg
  2019-09-04 20:10 ` [PATCH 2/2] git-gui: add horizontal scrollbar to commit buffer Bert Wesarg
                   ` (3 more replies)
  0 siblings, 4 replies; 21+ messages in thread
From: Bert Wesarg @ 2019-09-04 20:10 UTC (permalink / raw)
  To: git; +Cc: me, Birger Skogeng Pedersen, Bert Wesarg

The commit message widget does not wrap the next and has a configurable
fixed width to avoid creating too wide commit messages. Though this was
only enforced in the GUI. Now we also check the commit message at commit
time for long lines and ask the author for confirmation if it exceeds the
configured line length.

Needs Tcl 8.6 because of `lmap`.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
---
 git-gui.sh     |  4 ++--
 lib/commit.tcl | 10 ++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/git-gui.sh b/git-gui.sh
index 5bc21b8..a491085 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -31,8 +31,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA}]
 ##
 ## Tcl/Tk sanity check
 
-if {[catch {package require Tcl 8.4} err]
- || [catch {package require Tk  8.4} err]
+if {[catch {package require Tcl 8.6} err]
+ || [catch {package require Tk  8.6} err]
 } {
 	catch {wm withdraw .}
 	tk_messageBox \
diff --git a/lib/commit.tcl b/lib/commit.tcl
index 83620b7..fa9760b 100644
--- a/lib/commit.tcl
+++ b/lib/commit.tcl
@@ -215,6 +215,16 @@ A good commit message has the following format:
 		unlock_index
 		return
 	}
+	if {[tcl::mathfunc::max {*}[lmap x [split $msg "\n"] {string length $x}]] >= $repo_config(gui.commitmsgwidth) \
+	    && [ask_popup "Commit message contains lines longer than $repo_config(gui.commitmsgwidth) characters.
+
+You may change this limit in the options.
+
+Continue to commit?
+"] ne yes} {
+		unlock_index
+		return
+	}
 
 	# -- Build the message file.
 	#
-- 
2.21.0.789.ga095d9d866


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2019-09-12 19:26 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-04 20:10 [PATCH 1/2] git-gui: warn if the commit message contains lines longer than the set limit Bert Wesarg
2019-09-04 20:10 ` [PATCH 2/2] git-gui: add horizontal scrollbar to commit buffer Bert Wesarg
2019-09-04 20:31   ` Eric Sunshine
2019-09-04 20:46     ` Bert Wesarg
2019-09-10 20:28   ` Pratyush Yadav
2019-09-12 19:10     ` Bert Wesarg
2019-09-04 20:29 ` [PATCH 1/2] git-gui: warn if the commit message contains lines longer than the set limit Eric Sunshine
2019-09-04 20:43   ` Bert Wesarg
2019-09-04 22:48     ` Pratyush Yadav
2019-09-05  6:48       ` Birger Skogeng Pedersen
2019-09-05 17:46         ` Bert Wesarg
2019-09-06 14:08           ` Birger Skogeng Pedersen
2019-09-06 20:07             ` Philip Oakley
2019-09-10  8:04               ` David Aguilar
2019-09-10 19:42                 ` Pratyush Yadav
2019-09-05  6:21     ` Johannes Sixt
2019-09-05 17:43       ` Bert Wesarg
2019-09-10 16:50 ` Johannes Sixt
2019-09-12 19:26   ` Bert Wesarg
2019-09-10 20:34 ` Pratyush Yadav
2019-09-12 19:13   ` Bert Wesarg

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).