commit 793b939450f25c2e96cd312e618683f2517c7058 from: Omar Polo date: Sun Jun 12 15:45:11 2022 UTC got log: sync match_commit from tog So that 'got log -S' can match also the author and committer name, and the commit ID too. ok stsp@ commit - 80b7e8dae89b7912b88913f686ea0a23bd763a8d commit + 793b939450f25c2e96cd312e618683f2517c7058 blob - 7825117a1854a2737ac5b841f83716ac3749d20a blob + 9512f370f13a1ee7374e4ca2bbf0fb1bfceafee7 --- got/got.1 +++ got/got.1 @@ -829,8 +829,9 @@ or .Fl P option. .It Fl S Ar search-pattern -If specified, show only commits with a log message matched by the extended -regular expression +If specified, show only commits with a log message, author name, +committer name, or ID SHA1 hash matched by the extended regular +expression .Ar search-pattern . Lines in committed patches will be matched if .Fl p blob - 28ba9a46f202c773426d431a909c5dec6304d3ca blob + 1969207b146b1c39de82a5a2394b4097f809d897 --- 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;