Re: [PATCH v3 5/6] stash: apply stash using 'merge_ort_nonrecursive()'
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- May 12, 2022, 01:01 UTC
- Message-ID
- <20220512010124.1800540-1-jonathantanmy@google.com>
- In-Reply-To
- <e733c2fd9f497a8d80555126ec2e166e182ab8db.1652225552.git.gitgitgadget@gmail.com>
"Victoria Dye via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 10 quoted lines
> @@ -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.