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
1313### Fixed
1414
1515- 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 ) )
1617
1718## [ 17.3.0] - 2025-07-08
1819
Original file line number Diff line number Diff line change @@ -56,6 +56,14 @@ export class StashSaveCommand extends GlCommandBase {
5656 if ( repo != null ) {
5757 args = { ...args } ;
5858 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+ }
5967 }
6068 }
6169 } else if ( context . type === 'scm-states' ) {
@@ -126,23 +134,23 @@ async function getStashSaveArgsForScmStates(
126134 }
127135
128136 let hasStaged = 0 ;
129- // let hasWorking = 0 ;
130- // let hasUntracked = 0 ;
137+ let hasWorking = false ;
138+ let hasUntracked = false ;
131139
132140 const status = await repo ?. git . status . getStatus ( ) ;
133141 for ( const file of status ?. files ?? [ ] ) {
134142 if ( file . indexStatus ) {
135143 hasStaged ++ ;
136144 }
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+ }
143151 }
144152
145- if ( ! selectedWorking && ! selectedUntracked ) {
153+ if ( ! selectedWorking && ! selectedUntracked && ( hasWorking || hasUntracked ) ) {
146154 if ( ! ( await repo ?. git ?. supports ( 'git:stash:push:staged' ) ) ) {
147155 const confirm = { title : 'Stash All' } ;
148156 const cancel = { title : 'Cancel' , isCloseAffordance : true } ;
You can’t perform that action at this time.
0 commit comments