aboutsummaryrefslogtreecommitdiffstats
path: root/emacs/gitto.el
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/gitto.el')
-rw-r--r--emacs/gitto.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/emacs/gitto.el b/emacs/gitto.el
index 996ba7f..cddb2ac 100644
--- a/emacs/gitto.el
+++ b/emacs/gitto.el
@@ -40,12 +40,29 @@
:type 'string)
;;;###autoload
+(defun gitto-registered-p (dir)
+ "Check if DIR is a registered repository."
+ (not (string-match-p "not registered"
+ (shell-command-to-string
+ (concat gitto-program " -c " dir)))))
+
+;;;###autoload
(defun gitto-register (dir)
+ "Register DIR with gitto."
(interactive (list (locate-dominating-file (buffer-file-name) ".git")))
(unless dir
(error "Not a git repository."))
(shell-command (concat gitto-program " -r " dir)))
+;;;###autoload
+(defun gitto-unregister (dir)
+ "Unregister DIR with gitto."
+ (interactive (list (locate-dominating-file (buffer-file-name) ".git")))
+ (unless (and dir (gitto-registered-p dir))
+ (error "Not a registered git repository."))
+
+ (shell-command (concat gitto-program " -R " dir)))
+
(provide 'gitto)
;;; gitto.el ends here