Renamed add-thing-at-point to stage-sthing-at-point. Handle

staging/unstaging of whole diffs, not just hunks.
This commit is contained in:
Marius Vollmer 2008-08-05 01:20:27 +03:00
parent d91b0b2af7
commit a794e36fca

View file

@ -149,7 +149,7 @@
(suppress-keymap gits-keymap)
(define-key gits-keymap (kbd "g") 'git-status)
(define-key gits-keymap (kbd "S") 'git-stage-all)
(define-key gits-keymap (kbd "a") 'gits-add-thing-at-point)
(define-key gits-keymap (kbd "a") 'gits-stage-thing-at-point)
(define-key gits-keymap (kbd "u") 'gits-unstage-thing-at-point)
(define-key gits-keymap (kbd "i") 'gits-ignore-thing-at-point)
(define-key gits-keymap (kbd "RET") 'gits-visit-thing-at-point)
@ -250,11 +250,14 @@
;;; Staging
(defun gits-write-diff-patch (info file)
(write-region (elt info 1) (elt info 2) file))
(defun gits-write-hunk-patch (info file)
(write-region (elt info 1) (elt info 2) file)
(write-region (elt info 3) (elt info 4) file t))
(defun gits-add-thing-at-point ()
(defun gits-stage-thing-at-point ()
(interactive)
(let ((info (get-char-property (point) 'gits-info)))
(if info
@ -263,6 +266,9 @@
(gits-run "git" "add" (cadr info)))
((hunk)
(gits-write-hunk-patch info ".git/gits-tmp")
(gits-run "git" "apply" "--cached" ".git/gits-tmp"))
((diff)
(gits-write-diff-patch info ".git/gits-tmp")
(gits-run "git" "apply" "--cached" ".git/gits-tmp"))))))
(defun gits-unstage-thing-at-point ()
@ -272,6 +278,9 @@
(case (car info)
((hunk)
(gits-write-hunk-patch info ".git/gits-tmp")
(gits-run "git" "apply" "--cached" "--reverse" ".git/gits-tmp"))
((diff)
(gits-write-diff-patch info ".git/gits-tmp")
(gits-run "git" "apply" "--cached" "--reverse" ".git/gits-tmp"))))))
(defun gits-ignore-thing-at-point ()