From: Stefan Sperling Subject: Re: got patch vs unchanged files To: Omar Polo Cc: gameoftrees@openbsd.org Date: Sat, 19 Mar 2022 15:45:58 +0100 On Sat, Mar 19, 2022 at 02:21:33PM +0100, Omar Polo wrote: > I didn't know about the open_fileindex cost, i still haven't tried to > profile 'got patch'; but since I'm adding this code for the first time, > why don't do the correct thing from the start? :) > > updated diff with the function split into three: > got_worktree_patch_prepare which opens the fileindex, check_path which > does the path checks and patch_complete that closes the fileindex. > > atm i don't need to track state across the patch operation, so the > _prepare and _complete are just wrappers around the fileindex open/close > function. in the future i'd like to (or at least try to) create commits > from 'got patch' (akin to what 'git am' does) so it'll be useful. Looks good to me. I would rename patch_prepare_path() to patch_check_path(), but that is just cosmetic. ok stsp@ in any case.