* bug#24046: [PATCH] vc-git: prevent execution of git stash in error cases
@ 2016-07-21 12:46 Alexander Kuleshov
2017-06-04 3:00 ` npostavs
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Kuleshov @ 2016-07-21 12:46 UTC (permalink / raw)
To: 24046
[-- Attachment #1: Type: text/plain, Size: 173 bytes --]
Here is simple patch which adds two additional checks to the vc-git-stash-show
function to check that correct stash name is passed and actually repo
has stashes.
Thank you
[-- Attachment #2: 0001-vc-git-prevent-execution-of-git-stash-in-error-cases.patch --]
[-- Type: text/x-patch, Size: 1408 bytes --]
From f9fc64560dcf892826eddca535c0c869d2922041 Mon Sep 17 00:00:00 2001
From: Alexander Kuleshov <kuleshovmail@gmail.com>
Date: Thu, 21 Jul 2016 18:42:48 +0600
Subject: [PATCH] vc-git: prevent execution of git stash in error cases
* lisp/vc/vc-git.el (vc-git-stash-show): prevent execution if stash
name is empty or a repo hasn't stashes.
---
lisp/vc/vc-git.el | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index e6fe019..940738d 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1348,12 +1348,16 @@ vc-git-stash
(defun vc-git-stash-show (name)
"Show the contents of stash NAME."
(interactive "sStash name: ")
- (vc-setup-buffer "*vc-git-stash*")
- (vc-git-command "*vc-git-stash*" 'async nil "stash" "show" "-p" name)
- (set-buffer "*vc-git-stash*")
- (diff-mode)
- (setq buffer-read-only t)
- (pop-to-buffer (current-buffer)))
+ (if (string= name "")
+ (error "stash name can't be empty string."))
+ (if (eq (vc-git-stash-list) nil)
+ (error "There are no stashes.")
+ (vc-setup-buffer "*vc-git-stash*")
+ (vc-git-command "*vc-git-stash*" 'async nil "stash" "show" "-p" name)
+ (set-buffer "*vc-git-stash*")
+ (diff-mode)
+ (setq buffer-read-only t)
+ (pop-to-buffer (current-buffer))))
(defun vc-git-stash-apply (name)
"Apply stash NAME."
--
2.8.0.rc3.1353.gea9bdc0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#24046: [PATCH] vc-git: prevent execution of git stash in error cases
2016-07-21 12:46 bug#24046: [PATCH] vc-git: prevent execution of git stash in error cases Alexander Kuleshov
@ 2017-06-04 3:00 ` npostavs
2019-06-25 12:03 ` Lars Ingebrigtsen
0 siblings, 1 reply; 3+ messages in thread
From: npostavs @ 2017-06-04 3:00 UTC (permalink / raw)
To: Alexander Kuleshov; +Cc: 24046
Alexander Kuleshov <kuleshovmail@gmail.com> writes:
> Here is simple patch which adds two additional checks to the vc-git-stash-show
> function to check that correct stash name is passed and actually repo
> has stashes.
I'm not sure this is a good idea, we just end up duplicating checks that
'git stash' is going to perform anyway...
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#24046: [PATCH] vc-git: prevent execution of git stash in error cases
2017-06-04 3:00 ` npostavs
@ 2019-06-25 12:03 ` Lars Ingebrigtsen
0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-25 12:03 UTC (permalink / raw)
To: npostavs; +Cc: 24046, Alexander Kuleshov
npostavs@users.sourceforge.net writes:
> Alexander Kuleshov <kuleshovmail@gmail.com> writes:
>
>> Here is simple patch which adds two additional checks to the vc-git-stash-show
>> function to check that correct stash name is passed and actually repo
>> has stashes.
>
> I'm not sure this is a good idea, we just end up duplicating checks that
> 'git stash' is going to perform anyway...
I agree, and even if we did want to add these checks, they should be
done in all the stash-related commands...
So I'm closing this bug report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-25 12:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-21 12:46 bug#24046: [PATCH] vc-git: prevent execution of git stash in error cases Alexander Kuleshov
2017-06-04 3:00 ` npostavs
2019-06-25 12:03 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.