Skip to content

Commit f101392

Browse files
committed
Fixes AI stash message when all changes are staged
1 parent e413de5 commit f101392

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1414

1515
- Fixes unstaging files doesn't work in the Inspect/Details views ([#4485](https://github.com/gitkraken/vscode-gitlens/issues/4485))
1616
- Fixes error when stashing only staged changes ([#4490](https://github.com/gitkraken/vscode-gitlens/issues/4490))
17+
- Fixes AI stash message generation when all changes are staged
1718

1819
## [17.3.0] - 2025-07-08
1920

src/commands/git/stash.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,11 +642,21 @@ export class StashGitCommand extends QuickCommand<State> {
642642
using resume = step.freeze?.();
643643

644644
try {
645-
const diff = await state.repo.git.diff.getDiff?.(
645+
let diff = await state.repo.git.diff.getDiff?.(
646646
state.flags.includes('--staged') ? uncommittedStaged : uncommitted,
647647
undefined,
648648
state.uris?.length ? { uris: state.uris } : undefined,
649649
);
650+
651+
// If we didn't find a diff, check if everything is staged (e.g. diff to uncommittedStaged)
652+
if (!diff?.contents && !state.flags.includes('--staged')) {
653+
diff = await state.repo.git.diff.getDiff?.(
654+
uncommittedStaged,
655+
undefined,
656+
state.uris?.length ? { uris: state.uris } : undefined,
657+
);
658+
}
659+
650660
if (!diff?.contents) {
651661
void window.showInformationMessage('No changes to generate a stash message from.');
652662
return;

0 commit comments

Comments
 (0)