Commit Diff


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, &regmatch, 0) == 0)
+	if (regexec(regex, got_object_commit_get_author(commit), 1,
+	    &regmatch, 0) == 0 ||
+	    regexec(regex, got_object_commit_get_committer(commit), 1,
+	    &regmatch, 0) == 0 ||
+	    regexec(regex, id_str, 1, &regmatch, 0) == 0 ||
+	    regexec(regex, logmsg, 1, &regmatch, 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, &regex);
+			err = match_commit(&have_match, id, commit, &regex);
 			if (err) {
 				got_object_commit_close(commit);
 				break;