Git - add "Stashes" node to the repositories view (#279400)

* WIP - Initial implementation

* Get author and committer date for a stash

* Add drop stash command

* More cleanup
This commit is contained in:
Ladislau Szomoru
2025-11-25 17:13:48 +00:00
committed by GitHub
parent 0432ed536c
commit f297f37463
9 changed files with 279 additions and 59 deletions

View File

@@ -8,6 +8,7 @@ import { dirname, normalize, sep, relative } from 'path';
import { Readable } from 'stream';
import { promises as fs, createReadStream } from 'fs';
import byline from 'byline';
import { Stash } from './git';
export const isMacintosh = process.platform === 'darwin';
export const isWindows = process.platform === 'win32';
@@ -846,3 +847,19 @@ export function extractFilePathFromArgs(argv: string[], startIndex: number): str
// leading quote and return the path as-is
return path.slice(1);
}
export function getStashDescription(stash: Stash): string | undefined {
if (!stash.commitDate && !stash.branchName) {
return undefined;
}
const descriptionSegments: string[] = [];
if (stash.commitDate) {
descriptionSegments.push(fromNow(stash.commitDate));
}
if (stash.branchName) {
descriptionSegments.push(stash.branchName);
}
return descriptionSegments.join(' \u2022 ');
}