Renamed add-thing-at-point to stage-sthing-at-point. Handle
staging/unstaging of whole diffs, not just hunks.
This commit is contained in:
parent
d91b0b2af7
commit
a794e36fca
1 changed files with 11 additions and 2 deletions
|
@ -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 ()
|
||||
|
|
Loading…
Reference in a new issue