File tree Expand file tree Collapse file tree 2 files changed +18
-9
lines changed Expand file tree Collapse file tree 2 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
13
13
### Fixed
14
14
15
15
- Fixes unstaging files doesn't work in the Inspect/Details views ([ #4485 ] ( https://github.com/gitkraken/vscode-gitlens/issues/4485 ) )
16
+ - Fixes error when stashing only staged changes ([ #4490 ] ( https://github.com/gitkraken/vscode-gitlens/issues/4490 ) )
16
17
17
18
## [ 17.3.0] - 2025-07-08
18
19
Original file line number Diff line number Diff line change @@ -56,6 +56,14 @@ export class StashSaveCommand extends GlCommandBase {
56
56
if ( repo != null ) {
57
57
args = { ...args } ;
58
58
args . repoPath = repo . path ;
59
+
60
+ const status = await repo . git . status . getStatus ( ) ;
61
+ for ( const file of status ?. files ?? [ ] ) {
62
+ if ( file . status === '?' ) {
63
+ args . includeUntracked = true ;
64
+ break ;
65
+ }
66
+ }
59
67
}
60
68
}
61
69
} else if ( context . type === 'scm-states' ) {
@@ -126,23 +134,23 @@ async function getStashSaveArgsForScmStates(
126
134
}
127
135
128
136
let hasStaged = 0 ;
129
- // let hasWorking = 0 ;
130
- // let hasUntracked = 0 ;
137
+ let hasWorking = false ;
138
+ let hasUntracked = false ;
131
139
132
140
const status = await repo ?. git . status . getStatus ( ) ;
133
141
for ( const file of status ?. files ?? [ ] ) {
134
142
if ( file . indexStatus ) {
135
143
hasStaged ++ ;
136
144
}
137
- // if (file.workingTreeStatus) {
138
- // hasWorking++ ;
139
- // }
140
- // if (file.status === '?') {
141
- // hasUntracked++ ;
142
- // }
145
+ if ( file . workingTreeStatus ) {
146
+ hasWorking = true ;
147
+ }
148
+ if ( file . status === '?' ) {
149
+ hasUntracked = true ;
150
+ }
143
151
}
144
152
145
- if ( ! selectedWorking && ! selectedUntracked ) {
153
+ if ( ! selectedWorking && ! selectedUntracked && ( hasWorking || hasUntracked ) ) {
146
154
if ( ! ( await repo ?. git ?. supports ( 'git:stash:push:staged' ) ) ) {
147
155
const confirm = { title : 'Stash All' } ;
148
156
const cancel = { title : 'Cancel' , isCloseAffordance : true } ;
You can’t perform that action at this time.
0 commit comments