[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit ebd7a0635d 7/7: magit-{un, }stage-buffer-file:
|
From: |
ELPA Syncer |
|
Subject: |
[nongnu] elpa/git-commit ebd7a0635d 7/7: magit-{un, }stage-buffer-file: New commands |
|
Date: |
Sat, 20 May 2023 18:01:02 -0400 (EDT) |
branch: elpa/git-commit
commit ebd7a0635df4e38931f89d9e7cd4c5c4c8f1e730
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
magit-{un,}stage-buffer-file: New commands
Since a few commits ago `magit-stage-file' and `magit-unstage-file'
always prompt instead of immediately acting on the visited file.
---
lisp/magit-apply.el | 32 ++++++++++++++++++++++++++++++--
lisp/magit-files.el | 4 ++--
2 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/lisp/magit-apply.el b/lisp/magit-apply.el
index 77cab39b9f..b54259f372 100644
--- a/lisp/magit-apply.el
+++ b/lisp/magit-apply.el
@@ -297,6 +297,19 @@ at point, stage the file but not its content."
(`(undefined ,_ ,_) (user-error "Cannot stage this change")))
(call-interactively #'magit-stage-file)))
+;;;###autoload
+(defun magit-stage-buffer-file ()
+ "Stage all changes to the file being visited in the current buffer."
+ (interactive)
+ (unless buffer-file-name
+ (user-error "Not visiting a file"))
+ (magit-with-toplevel
+ (magit-stage-1 (and (magit-file-ignored-p buffer-file-name)
+ (if (y-or-n-p "Visited file is ignored; stage anyway?")
+ "--force"
+ (user-error "Abort")))
+ (list (magit-file-relative-name)))))
+
;;;###autoload
(defun magit-stage-file (files)
"Read one or more files and stage all changes in those files.
@@ -384,7 +397,10 @@ ignored) files."
(magit-wip-commit-after-apply files " after stage")))
(defvar magit-post-stage-hook-commands
- '(magit-stage magit-stage-file magit-stage-modified))
+ '(magit-stage
+ magit-stage-buffer-file
+ magit-stage-file
+ magit-stage-modified))
(defun magit-run-post-stage-hook ()
(when (memq this-command magit-post-stage-hook-commands)
@@ -417,6 +433,15 @@ ignored) files."
(user-error "Cannot unstage committed
changes")))
(`(undefined ,_ ,_) (user-error "Cannot unstage this change")))))
+;;;###autoload
+(defun magit-unstage-buffer-file ()
+ "Unstage all changes to the file being visited in the current buffer."
+ (interactive)
+ (unless buffer-file-name
+ (user-error "Not visiting a file"))
+ (magit-with-toplevel
+ (magit-unstage-1 (list (magit-file-relative-name)))))
+
;;;###autoload
(defun magit-unstage-file (files)
"Read one or more files and unstage all changes to those files."
@@ -459,7 +484,10 @@ ignored) files."
(magit-wip-commit-after-apply nil " after unstage"))
(defvar magit-post-unstage-hook-commands
- '(magit-unstage magit-unstage-file magit-unstage-all))
+ '(magit-unstage
+ magit-unstage-buffer-file
+ magit-unstage-file
+ magit-unstage-all))
(defun magit-run-post-unstage-hook ()
(when (memq this-command magit-post-unstage-hook-commands)
diff --git a/lisp/magit-files.el b/lisp/magit-files.el
index b12bcc9cf1..492deba58a 100644
--- a/lisp/magit-files.el
+++ b/lisp/magit-files.el
@@ -291,8 +291,8 @@ to `magit-dispatch'."
:info-manual "(magit) Minor Mode for Buffers Visiting Files"
["File actions"
:if magit-file-relative-name
- [("s" "Stage" magit-stage-file)
- ("u" "Unstage" magit-unstage-file)
+ [("s" "Stage" magit-stage-buffer-file)
+ ("u" "Unstage" magit-unstage-buffer-file)
("c" "Commit" magit-commit)
("e" "Edit line" magit-edit-line-commit)]
[("D" "Diff..." magit-diff)
- [nongnu] elpa/git-commit updated (33d1e41d69 -> ebd7a0635d), ELPA Syncer, 2023/05/20
- [nongnu] elpa/git-commit be12ac7511 3/7: magit-stage-file: With a prefix argument offer ignored files, ELPA Syncer, 2023/05/20
- [nongnu] elpa/git-commit 09f600fdcd 1/7: magit-{un, }stage-file: Always prompt, ELPA Syncer, 2023/05/20
- [nongnu] elpa/git-commit df8095b4da 2/7: magit-{un, }stage-file: Support acting on multiple files, ELPA Syncer, 2023/05/20
- [nongnu] elpa/git-commit 9c6207bb84 4/7: magit-file-dispatch: No longer pivot if not visiting file, ELPA Syncer, 2023/05/20
- [nongnu] elpa/git-commit a4a007f51b 6/7: magit-file-tracked-p: Separate file arguments from other arguments, ELPA Syncer, 2023/05/20
- [nongnu] elpa/git-commit ebd7a0635d 7/7: magit-{un, }stage-buffer-file: New commands,
ELPA Syncer <=
- [nongnu] elpa/git-commit 98a1f1d74b 5/7: magit-file-ignored-p: New function, ELPA Syncer, 2023/05/20