From: Stefan Sperling Subject: Re: [patch] filter log by author pattern To: Omar Polo Cc: Evan Silberman , Mikhail , gameoftrees@openbsd.org Date: Sun, 12 Jun 2022 16:55:51 +0200 On Sun, Jun 12, 2022 at 04:38:39PM +0200, Omar Polo wrote: > so... at least for the moment, what about syncinc tog and got > match_commit? This way we have -S searching on the commit id itself, > author and committer. Yes, ok stsp > diff 3ef807eedd4fec23cf457ea7cd55bc01407d57b9 /home/op/w/got > blob - 28ba9a46f202c773426d431a909c5dec6304d3ca > file + got/got.c > --- got/got.c > +++ got/got.c > @@ -3731,7 +3731,7 @@ get_datestr(time_t *time, char *datebuf) > } > > static const struct got_error * > -match_logmsg(int *have_match, struct got_object_id *id, > +match_commit(int *have_match, struct got_object_id *id, > struct got_commit_object *commit, regex_t *regex) > { > const struct got_error *err = NULL; > @@ -3748,7 +3748,12 @@ match_logmsg(int *have_match, struct got_object_id *id > if (err) > goto done; > > - if (regexec(regex, logmsg, 1, ®match, 0) == 0) > + if (regexec(regex, got_object_commit_get_author(commit), 1, > + ®match, 0) == 0 || > + regexec(regex, got_object_commit_get_committer(commit), 1, > + ®match, 0) == 0 || > + regexec(regex, id_str, 1, ®match, 0) == 0 || > + regexec(regex, logmsg, 1, ®match, 0) == 0) > *have_match = 1; > done: > free(id_str); > @@ -4067,7 +4072,7 @@ print_commits(struct got_object_id *root_id, struct go > } > > if (search_pattern) { > - err = match_logmsg(&have_match, id, commit, ®ex); > + err = match_commit(&have_match, id, commit, ®ex); > if (err) { > got_object_commit_close(commit); > break; > >