Hi Paul, On Mon, 25 Jun 2018, Paul-Sebastian Ungureanu wrote: > diff --git a/builtin/stash--helper.c b/builtin/stash--helper.c > index 1c4387b10..84a537f39 100644 > --- a/builtin/stash--helper.c > +++ b/builtin/stash--helper.c > @@ -414,6 +451,77 @@ static int apply_stash(int argc, const char **argv, const char *prefix) > return ret; > } > > +static int do_drop_stash(const char *prefix, struct stash_info *info) > +{ > + struct argv_array args = ARGV_ARRAY_INIT; > + struct child_process cp = CHILD_PROCESS_INIT; > + int ret; > + > + /* > + * reflog does not provide a simple function for deleting refs. One will > + * need to be added to avoid implementing too much reflog code here > + */ > + argv_array_pushl(&args, "reflog", "delete", "--updateref", "--rewrite", > + NULL); > + argv_array_push(&args, info->revision.buf); > + ret = cmd_reflog(args.argc, args.argv, prefix); > + if (!ret) { > + if (!quiet) > + printf(_("Dropped %s (%s)\n"), info->revision.buf, > + oid_to_hex(&info->w_commit)); > + } else { > + return error(_("%s: Could not drop stash entry"), info->revision.buf); > + } > + > + /* > + * This could easily be replaced by get_oid, but currently it will throw a > + * fatal error when a reflog is empty, which we can not recover from > + */ > + cp.git_cmd = 1; > + /* Even though --quiet is specified, rev-parse still outputs the hash */ > + cp.no_stdout = 1; > + argv_array_pushl(&cp.args, "rev-parse", "--verify", "--quiet", NULL); > + argv_array_pushf(&cp.args, "%s@{0}", ref_stash); > + ret = run_command(&cp); I thought you had introduced `get_oidf()` specifically so you could avoid the `rev-parse` call... `get_oidf(&dummy_oid, "%s@{0}", ref_stash)` should do this, right? Ciao, Dscho