"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: got patch: recover from some kinds of errors
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Mon, 14 Mar 2022 13:57:22 +0100

Download raw body.

Thread
On Sun, Mar 13, 2022 at 09:54:43PM +0100, Omar Polo wrote:
> Omar Polo <op@omarpolo.com> wrote:
> > Hello,
> > 
> > (probably last diff for the day)
> > 
> > The attached diff makes `got patch' continue upon encountering some
> > kinds of errors; it still exits with an error, but proceed instead of
> > stopping at the first issue.
> > 
> > Not every kind of error is recoverable thought: a malformed patch for
> > instance, or others I/O errors are fatal.
> > 
> > The diff should be short, but there is some long changes in the regress
> > suite where I'm taking advantage of this behaviour to shorten some tests
> > quite a bit.
> 
> The change in test_patch_dont_apply was wrong and I missed one
> got_error/got_error_path conversion in patch_file, updated diff.
> 
> sorry for the noise

Could this be done with a "progress" callback instead of an "error"
callback? If needed, a progress callback could receive an 'error'
parameter in addition to a 'status'.

We don't have any callback yet that only deals with errors, that is
why I am asking. During updates for instance all such cases would
be handled by the regular update progress callback.

I also see that we've added two progress callbacks to got_patch(),
one for additions and one for deletions. This is redundant.
You probably did this to be able to reuse the existing add_progress
and print_remove_status callbacks? These callbacks are specific to
'got add' and 'got delete' and should remain independent.

Couldn't got_patch() handle all these cases with a single
patch-specific progress callback?