all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#32636: 26.1; Support git commit --no-verify
@ 2018-09-04 21:09 Matthias Meulien
  2018-12-10 23:20 ` Dmitry Gutov
  0 siblings, 1 reply; 4+ messages in thread
From: Matthias Meulien @ 2018-09-04 21:09 UTC (permalink / raw)
  To: 32636


[-- Attachment #1.1: Type: text/plain, Size: 3480 bytes --]

Sometimes one wants to skip the pre-commit and commit-msg hooks when
commiting changes to a Git repository. At the present time, it isn't
possible using the Git interface of Emacs: One must switch to Git CLI.

The attached patch adds a function `vc-git-log-edit-toggle-no-verify`
and a key binding for that function, so that users can skip the
mentioned hooks.

In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2018-07-05 built on juergen
Windowing system distributor 'The X.Org Foundation', version
11.0.12001000
System Description:	Arch Linux

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-modules
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-
strong
 -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS
GTK3 X11 MODULES THREADS LIBSYSTEMD LCMS2

Important settings:
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham
georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting move-toolbar
gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 95008 9393)
 (symbols 48 20354 1)
 (miscs 40 94 118)
 (strings 32 28151 1578)
 (string-bytes 1 741345)
 (vectors 16 14763)
 (vector-slots 8 491216 7706)
 (floats 8 55 62)
 (intervals 56 258 0)
 (buffers 992 12))



[-- Attachment #1.2: 0001-Support-git-commit-no-verify.patch --]
[-- Type: text/x-patch, Size: 1724 bytes --]

From 8fa952e6b429892dbe697821e6e1d826336c4f03 Mon Sep 17 00:00:00 2001
From: Matthias Meulien <orontee@gmail.com>
Date: Tue, 4 Sep 2018 22:50:56 +0200
Subject: [PATCH] Support git commit --no-verify

* lisp/vc/vc-git.el (vc-git-log-edit-toggle-no-verify): New function.
---
 lisp/vc/vc-git.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 88052d7749..9f5ab84d15 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -751,6 +751,11 @@ vc-git-log-edit-toggle-signoff
   (interactive)
   (log-edit-toggle-header "Sign-Off" "yes"))
 
+(defun vc-git-log-edit-toggle-no-verify ()
+  "Toggle whether to bypass the pre-commit and commit-msg hooks."
+  (interactive)
+  (log-edit-toggle-header "No-Verify" "yes"))
+
 (defun vc-git-log-edit-toggle-amend ()
   "Toggle whether this will amend the previous commit.
 If toggling on, also insert its message into the buffer."
@@ -776,6 +781,7 @@ vc-git-log-edit-toggle-amend
 (defvar vc-git-log-edit-mode-map
   (let ((map (make-sparse-keymap "Git-Log-Edit")))
     (define-key map "\C-c\C-s" 'vc-git-log-edit-toggle-signoff)
+    (define-key map "\C-c\C-n" 'vc-git-log-edit-toggle-no-verify)
     (define-key map "\C-c\C-e" 'vc-git-log-edit-toggle-amend)
     map))
 
@@ -819,6 +825,7 @@ vc-git-checkin
                             `(("Author" . "--author")
                               ("Date" . "--date")
                               ("Amend" . ,(boolean-arg-fn "--amend"))
+                              ("No-Verify" . ,(boolean-arg-fn "--no-verify"))
                               ("Sign-Off" . ,(boolean-arg-fn "--signoff")))
                             comment)))
                       (when msg-file
-- 
2.18.0


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* bug#32636: 26.1; Support git commit --no-verify
  2018-09-04 21:09 bug#32636: 26.1; Support git commit --no-verify Matthias Meulien
@ 2018-12-10 23:20 ` Dmitry Gutov
       [not found]   ` <1544484374.8533.1.camel@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Gutov @ 2018-12-10 23:20 UTC (permalink / raw)
  To: Matthias Meulien, 32636-done

Version: 27.0

Hi!

On 05.09.2018 0:09, Matthias Meulien wrote:
> Sometimes one wants to skip the pre-commit and commit-msg hooks when
> commiting changes to a Git repository. At the present time, it isn't
> possible using the Git interface of Emacs: One must switch to Git CLI.
> 
> The attached patch adds a function `vc-git-log-edit-toggle-no-verify`
> and a key binding for that function, so that users can skip the
> mentioned hooks.

Thank you, pushed to master.

Please note that the commit message was a bit lacking. Here's the one I 
pushed with:

     Support git commit --no-verify

     * lisp/vc/vc-git.el (vc-git-log-edit-toggle-no-verify): New function.
     (vc-git-log-edit-mode-map): Add binding.
     (vc-git-checkin): Add an entry for that header.





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

* bug#32636: 26.1; Support git commit --no-verify
       [not found]   ` <1544484374.8533.1.camel@gmail.com>
@ 2018-12-10 23:40     ` Dmitry Gutov
  2018-12-10 23:44       ` Matthias Meulien
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Gutov @ 2018-12-10 23:40 UTC (permalink / raw)
  To: Matthias Meulien; +Cc: 32636

On 11.12.2018 1:26, Matthias Meulien wrote:
>> Thank you, pushed to master.
> 
> Thanks for your prompt reply!

No problem. Please keep the bug address in Cc.

> I was thinking of adding support for `squash' and `fixup' options of
> git commit; Tell me if you're interested, I'll work on it.

Never used them myself.

I take it --fixup is an alternative to --amend, but won't you have to 
call 'git rebase' from the command line in the end anyway? What's the 
benefit to calling from within Emacs? (A short answer would be ok).





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

* bug#32636: 26.1; Support git commit --no-verify
  2018-12-10 23:40     ` Dmitry Gutov
@ 2018-12-10 23:44       ` Matthias Meulien
  0 siblings, 0 replies; 4+ messages in thread
From: Matthias Meulien @ 2018-12-10 23:44 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 32636

[-- Attachment #1: Type: text/plain, Size: 265 bytes --]

> I take it --fixup is an alternative to --amend, but won't you have
> to call 'git rebase' from the command line in the end anyway? What's
> the benefit to calling from within Emacs?

You're right, a complete workflow in Emacs isn't that clear.
-- 
Matthias

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2018-12-10 23:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-04 21:09 bug#32636: 26.1; Support git commit --no-verify Matthias Meulien
2018-12-10 23:20 ` Dmitry Gutov
     [not found]   ` <1544484374.8533.1.camel@gmail.com>
2018-12-10 23:40     ` Dmitry Gutov
2018-12-10 23:44       ` Matthias Meulien

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.