git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: gitweb filter for patches by a specific person in a specific timeframe

From
Linus Torvalds <torvalds@osdl.org>
Date
Aug 28, 2006, 19:04 UTC
Message-ID
<Pine.LNX.4.64.0608281147420.27779@g5.osdl.org>
In-Reply-To
<20060828181626.GB2950@coredump.intra.peff.net>
On Mon, 28 Aug 2006, Jeff King wrote:
> 
> You can create an mbox of all of the changes you made. Unfortunately
> git-rev-list doesn't do author/committer matching, so you'll need a
> short perl script:

The author/committer matching is something that people have talked about for a long time, so maybe we should just add it?

It shouldn't be that hard at all. Just add logic to revision.c: get_revision(), something like the appended (fleshed out and fixed, of course, with all the command line flags added to actually allow setting of "revs->author_pattern" etc..)

A good thing for some beginning git hacker to try doing. Hint, hint.

(The only subtle thing might be to make sure that "save_commit_buffer" is set if author/committer matching is on, so that the "commit->buffer" thing is actually saved after parsing, so that you can match it)

This trivial approach doesn't allow "gitk" to show the results sanely, though (to do that, you'd need to make the commit matching be part of the parent simplification instead - that would be extra bonus points for the intrpid git hacker-wannabe)

		Linus
---
diff --git a/revision.c b/revision.c
index 1d89d72..88cc1e3 100644
--- a/revision.c
+++ b/revision.c
@@ -1011,6 +1011,13 @@ static void mark_boundary_to_show(struct
 	}
 }
 
+static int commit_match(struct commit *commit, const char *field, const char *pattern)
+{
+	if (!pattern)
+		return 1;
+	.. match it here ..
+}
+
 struct commit *get_revision(struct rev_info *revs)
 {
 	struct commit_list *list = revs->commits;
@@ -1070,6 +1077,10 @@ struct commit *get_revision(struct rev_i
 		if (revs->no_merges &&
 		    commit->parents && commit->parents->next)
 			continue;
+		if (!commit_match(commit, "author", revs->author_pattern))
+			continue;
+		if (!commit_match(commit, "committer", revs->committer_pattern))
+			continue;
 		if (revs->prune_fn && revs->dense) {
 			/* Commit without changes? */
 			if (!(commit->object.flags & TREECHANGE)) {
Previous: Jeff KingNext: Jonas Fonseca
Message 4 of 7 in “gitweb filter for patches by a specific person in a specific timeframe”
  1. Kai BlinAug 28, 2006
  2. Jakub NarebskiAug 28, 2006
  3. Jeff KingAug 28, 2006
  4. Linus TorvaldsAug 28, 2006
  5. Support author and commiter based revision list limitingJonas Fonseca, Aug 31, 2006
  6. Junio C HamanoSep 1, 2006
  7. git log --author='Jeff King'Junio C Hamano, Sep 18, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.