"Victoria Dye via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > @@ -551,10 +553,26 @@ static int do_apply_stash(const char *prefix, struct stash_info *info, > if (o.verbosity >= 3) > printf_ln(_("Merging %s with %s"), o.branch1, o.branch2); > > - bases[0] = &info->b_tree; > + head = lookup_tree(o.repo, &c_tree); > + merge = lookup_tree(o.repo, &info->w_tree); > + merge_base = lookup_tree(o.repo, &info->b_tree); > + > + repo_hold_locked_index(o.repo, &lock, LOCK_DIE_ON_ERROR); What's the reason for locking the index? I would think that merge_ort_nonrecursive() does not modify the index (in any case, I removed the locking code and the tests still pass). And as for changes in the worktree, I ran "strace" on the "stash apply" in the test and I didn't see any changes in the worktree from here until the lock is released. Other than that, this patch set looks good to me.