From 4b06e72b32b7bdc8d320a49e19129414723a804d Mon Sep 17 00:00:00 2001 From: HermesSantos Date: Sat, 8 Aug 2026 23:10:22 -0300 Subject: [PATCH] fixes the stash deleting error and stash id on modal --- app/ui/src/i18n/en.json | 2 +- app/ui/src/i18n/es.json | 2 +- app/ui/src/i18n/pt-br.json | 2 +- ui/electron/src/Commands/Stash.js | 16 ++++++++++++++-- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/ui/src/i18n/en.json b/app/ui/src/i18n/en.json index 8090c1b..2017d54 100644 --- a/app/ui/src/i18n/en.json +++ b/app/ui/src/i18n/en.json @@ -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.", diff --git a/app/ui/src/i18n/es.json b/app/ui/src/i18n/es.json index c9ef509..85fc17e 100644 --- a/app/ui/src/i18n/es.json +++ b/app/ui/src/i18n/es.json @@ -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.", diff --git a/app/ui/src/i18n/pt-br.json b/app/ui/src/i18n/pt-br.json index 62ef4de..34a4e1c 100644 --- a/app/ui/src/i18n/pt-br.json +++ b/app/ui/src/i18n/pt-br.json @@ -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.", diff --git a/ui/electron/src/Commands/Stash.js b/ui/electron/src/Commands/Stash.js index 3a9d1e5..2ad3303 100644 --- a/ui/electron/src/Commands/Stash.js +++ b/ui/electron/src/Commands/Stash.js @@ -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); } } /**