aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2012-10-17 23:46:31 +0200
committerGravatar Tom Willemsen2012-10-17 23:46:31 +0200
commit944001ce94ed57b3fc84d6f7b2c83bf0c101f3fa (patch)
tree95017e69723d1002bcebe75f6eb9a8561569030a
parent8e7188860207ca03e16693a730a175372e8da899 (diff)
downloadgitto-944001ce94ed57b3fc84d6f7b2c83bf0c101f3fa.tar.gz
gitto-944001ce94ed57b3fc84d6f7b2c83bf0c101f3fa.zip
Add unregister command to emacs interface
* emacs/gitto.el (gitto-registered-p): New function. (gitto-unregister): New command (gitto-register): Add docstring.
-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