[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 09f600fdcd 1/7: magit-{un, }stage-file: Always
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 09f600fdcd 1/7: magit-{un, }stage-file: Always prompt |
Date: |
Sat, 20 May 2023 18:01:01 -0400 (EDT) |
branch: elpa/git-commit
commit 09f600fdcdc1b0f4ad499037f2f393494c120de1
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
magit-{un,}stage-file: Always prompt
Since these commands are shadowed by `magit-stage' or `magit-unstage'
in places where it makes sense to act on the file at point without
prompting, remove the ability to do the same from these commands.
Doing that makes it possible to change these commands further, without
making their docstring and prefix argument handling more complex than
needed.
Continue to default to the file represented by the section at point.
That normally is irrelevant, but if the user invoked these commands by
other means than "s" and "u", then that default would still be useful.
The ability to un-/stage the visited file without any prompt, is going
to be restored in a few commits, by adding new specialized commands.
---
lisp/magit-apply.el | 38 ++++++++++++++------------------------
1 file changed, 14 insertions(+), 24 deletions(-)
diff --git a/lisp/magit-apply.el b/lisp/magit-apply.el
index 62e7dfd83b..8ec78e6007 100644
--- a/lisp/magit-apply.el
+++ b/lisp/magit-apply.el
@@ -299,20 +299,15 @@ at point, stage the file but not its content."
;;;###autoload
(defun magit-stage-file (file)
- "Stage all changes to FILE.
-With a prefix argument or when there is no file at point ask for
-the file to be staged. Otherwise stage the file at point without
-requiring confirmation."
+ "Read a file and stage all changes to that file."
(interactive
- (let* ((atpoint (magit-section-value-if 'file))
- (current (magit-file-relative-name))
- (choices (nconc (magit-unstaged-files)
+ (let* ((choices (nconc (magit-unstaged-files)
(magit-untracked-files)))
- (default (car (member (or atpoint current) choices))))
- (list (if (or current-prefix-arg (not default))
- (magit-completing-read "Stage file" choices
- nil t nil nil default)
- default))))
+ (default (or (magit-section-value-if 'file)
+ (magit-file-relative-name)))
+ (default (car (member default choices))))
+ (list (magit-completing-read "Stage file" choices
+ nil t nil nil default))))
(magit-with-toplevel
(magit-stage-1 nil (list file))))
@@ -418,19 +413,14 @@ ignored) files."
;;;###autoload
(defun magit-unstage-file (file)
- "Unstage all changes to FILE.
-With a prefix argument or when there is no file at point ask for
-the file to be unstaged. Otherwise unstage the file at point
-without requiring confirmation."
+ "Read a file and unstage all changes to that file."
(interactive
- (let* ((atpoint (magit-section-value-if 'file))
- (current (magit-file-relative-name))
- (choices (magit-staged-files))
- (default (car (member (or atpoint current) choices))))
- (list (if (or current-prefix-arg (not default))
- (magit-completing-read "Unstage file" choices
- nil t nil nil default)
- default))))
+ (let* ((choices (magit-staged-files))
+ (default (or (magit-section-value-if 'file)
+ (magit-file-relative-name)))
+ (default (car (member default choices))))
+ (list (magit-completing-read "Unstage file" choices
+ nil t nil nil default))))
(magit-with-toplevel
(magit-unstage-1 (list file))))
- [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 <=
- [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, 2023/05/20
- [nongnu] elpa/git-commit 98a1f1d74b 5/7: magit-file-ignored-p: New function, ELPA Syncer, 2023/05/20