commit 4fe9456b4b22d120d0215786744a9f4c0762bf9a from: Omar Polo via: Thomas Adam date: Mon Jun 13 17:55:22 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 - bccd1d5d167c0b7fabb334513fdb5250df673c9a commit + 4fe9456b4b22d120d0215786744a9f4c0762bf9a 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 - 28b7c58946126425fb58c0b17940971c270110ba blob + 764c2ad6b17fe1432f8b902b43963dd4d9efd5e4 --- got/got.c +++ got/got.c @@ -3730,7 +3730,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; @@ -3747,7 +3747,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); @@ -4066,7 +4071,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;