Download raw body.
got patch vs unchanged files
On Fri, Mar 18, 2022 at 06:47:06PM +0100, Omar Polo wrote: > While testing a diff for an unrelated thing I noticed that `got patch' > fails to handle the case of a patch that tries to add a file already > versioned. > > Long story short, I'm using got_worktree_status to check the status of a > file before applying the patch. got_worktree_status calls > worktree_status with report_unchanged=0, so the `can_add' callback in > lib/patch.c doesn't get called and check_file_status assumes that it's > possible to add the file. > > Patch below adds another argument to got_worktree_status so the caller > can decide to have also unchanged files reported to the callback. If we > don't want to change got_worktree_status I have another idea to solve > this issue locally in patch.c, but I thought this was the easiest way. Alternatively, you could move worktree-specific functionality from patch.c into worktree.c. Then you would get direct access to the static function worktree_status() from your new worktree.c function which patch.c would call. FWIW, this is also how other commands like rebase and histedit check their work tree preconditions.
got patch vs unchanged files