Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/ui/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@
"stash": {
"pop": "Apply & Drop (Pop)",
"drop_title": "Drop Stash",
"drop_msg": "Are you sure you want to drop stash@{{index}}?",
"drop_msg": "Are you sure you want to drop stash{'@'}{index}?",
"apply": "Apply",
"apply_title": "Apply stash?",
"apply_msg": "Apply stash {index} to your working copy? It will be kept in the list.",
Expand Down
2 changes: 1 addition & 1 deletion app/ui/src/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"stash": {
"pop": "Aplicar y Eliminar (Pop)",
"drop_title": "Eliminar Stash",
"drop_msg": "¿Estás seguro de que deseas eliminar stash@{{index}}?",
"drop_msg": "¿Estás seguro de que deseas eliminar stash{'@'}{index}?",
"apply": "Aplicar",
"apply_title": "¿Aplicar stash?",
"apply_msg": "¿Aplicar el stash {index} a tu copia de trabajo? Se mantendrá en la lista.",
Expand Down
2 changes: 1 addition & 1 deletion app/ui/src/i18n/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"stash": {
"pop": "Aplicar e Remover (Pop)",
"drop_title": "Remover Stash",
"drop_msg": "Tem certeza que deseja remover stash@{{index}}?",
"drop_msg": "Tem certeza que deseja remover stash{'@'}{index}?",
"apply": "Aplicar",
"apply_title": "Aplicar stash?",
"apply_msg": "Aplicar o stash {index} na cópia de trabalho? Ele será mantido na lista.",
Expand Down
16 changes: 14 additions & 2 deletions ui/electron/src/Commands/Stash.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,22 @@ class Stash extends Command {
}

/**
* Drop a stash entry
* Drop a stash entry.
* The UI passes the stash commit OID; `git stash drop` only accepts
* stash@{n}, so resolve the OID to an index first.
*/
async drop(repoPath, stashId) {
try { await this.execGit(repoPath, stashId ? ['stash', 'drop', stashId] : ['stash', 'drop']); return true; } catch (e) { throw new Error(e.message); }
try {
let ref;
if (stashId) {
const stashes = await this.getStashes(repoPath);
const entry = stashes.find((s) => s.id === stashId);
if (!entry) throw new Error(`stash entry not found: ${stashId}`);
ref = `stash@{${entry.id}}`;
}
await this.execGit(repoPath, ref ? ['stash', 'drop', ref] : ['stash', 'drop']);
return true;
} catch (e) { throw new Error(e.message); }
}

/**
Expand Down
Loading