Commit f4c7e72866fd

Vincent Demeester <vincent@sbr.pm>
2022-08-25 11:33:20
tools/emacs: add push options to magit-push
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 7628a06
Changed files (1)
tools
emacs
tools/emacs/config/config-vcs.el
@@ -83,6 +83,17 @@
     ?S "Sign using gpg" "--gpg-sign=" #'magit-read-gpg-secret-key)
   (magit-define-popup-switch 'magit-log-popup
     ?m "Omit merge commits" "--no-merges")
+  ;; cargo-culted from https://github.com/magit/magit/issues/3717#issuecomment-734798341
+  ;; valid gitlab options are defined in https://docs.gitlab.com/ee/user/project/push_options.html
+  ;;
+  ;; the second argument to transient-append-suffix is where to append
+  ;; to, not sure what -u is, but this works
+  (transient-append-suffix 'magit-push "-u"
+    '(1 "=s" "Skip gitlab pipeline" "--push-option=ci.skip"))
+  (transient-append-suffix 'magit-push "=s"
+    '(1 "=m" "Create gitlab merge-request" "--push-option=merge_request.create"))
+  (transient-append-suffix 'magit-push "=m"
+    '(1 "=o" "Set push option" "--push-option="))  ;; Will prompt, can only set one extra
 
   ;; Hide "Recent Commits"
   (magit-add-section-hook 'magit-status-sections-hook