From: Jonathan Tan Date: Thu, 12 May 2022 01:01:23 GMT Subject: Re: [PATCH v3 5/6] stash: apply stash using 'merge_ort_nonrecursive()' Message-ID: <20220512010124.1800540-1-jonathantanmy@google.com> In-Reply-To: "Victoria Dye via GitGitGadget" 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.