about summary refs log tree commit diff
path: root/emacs/.emacs.d/wpc/wpc-misc.el
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-08-20T17·41+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-08-20T17·41+0100
commit5b6862ea392d5ccf767999b2f06bc761b7ee4e5c (patch)
tree94bdac98df6f279e56773f29ec9a06ce12b4d1d9 /emacs/.emacs.d/wpc/wpc-misc.el
parent17c68d654ba7c4f01b730ceb804bdfa16c041174 (diff)
Call `git secret hide` whenever //secrets.json is saved
Having `git secret hide` as a pre-commit hook doesn't make much sense to me. I
will detail why when/if I write a blog post on briefcase's secret mgt setup.

The problem is, if I change secrets.json and then run `git status`, I won't see
any pending changes. This is because secrets.json is gitignore'd. If I run `git
secret hide` everytime I save secrets.json, I can rest assured that my `git
status` will be consistent with any updates to secrets.json.
Diffstat (limited to 'emacs/.emacs.d/wpc/wpc-misc.el')
-rw-r--r--emacs/.emacs.d/wpc/wpc-misc.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/emacs/.emacs.d/wpc/wpc-misc.el b/emacs/.emacs.d/wpc/wpc-misc.el
index c10f8d5d1ce2..fd65dc21485c 100644
--- a/emacs/.emacs.d/wpc/wpc-misc.el
+++ b/emacs/.emacs.d/wpc/wpc-misc.el
@@ -180,6 +180,12 @@
 ;; trim whitespace on save
 (add-hook 'before-save-hook #'delete-trailing-whitespace)
 
+;; call `git secret hide` after saving ~/briefcase/secrets.json
+(add-hook 'after-save-hook
+          (lambda ()
+            (when (f-equal? (buffer-file-name) "~/briefcase/secrets.json")
+              (shell-command "git secret hide"))))
+
 ;; use tabs instead of spaces
 (setq-default indent-tabs-mode nil)