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

[PATCH WIP 3/3] log: add --exclude option

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Oct 5, 2011, 07:18 UTC
Message-ID
<1317799088-26626-4-git-send-email-pclouds@gmail.com>
In-Reply-To
<1317799088-26626-1-git-send-email-pclouds@gmail.com>

This only helps filtering out commits whose changes are _entirely_ filtered out. This does not affect patch generate (--patch, --stat and so on)

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 revision.c |    7 +++++--
 revision.h |    2 ++
 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/revision.c b/revision.c
index c46cfaa..8472553 100644
--- a/revision.c
+++ b/revision.c
@@ -334,8 +334,8 @@ static int rev_compare_tree(struct rev_info *revs, struct commit *parent, struct
 
 	tree_difference = REV_TREE_SAME;
 	DIFF_OPT_CLR(&revs->pruning, HAS_CHANGES);
-	if (diff_tree_sha1(t1->object.sha1, t2->object.sha1, "",
-			   &revs->pruning) < 0)
+	if (diff_tree_sha1_with_exclude(t1->object.sha1, t2->object.sha1, "",
+					&revs->pruning, &revs->el, 0, 0) < 0)
 		return REV_TREE_DIFFERENT;
 	return tree_difference;
 }
@@ -1454,6 +1454,9 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
 		return argcount;
 	} else if (!strcmp(arg, "--log-size")) {
 		revs->show_log_size = 1;
+	} else if (!prefixcmp(arg, "--exclude=")) {
+		add_exclude(arg + 10, "", 0, &revs->el);
+		revs->prune = 1;
 	}
 	/*
 	 * Grepping the commit log
diff --git a/revision.h b/revision.h
index 3d64ada..3709959 100644
--- a/revision.h
+++ b/revision.h
@@ -4,6 +4,7 @@
 #include "parse-options.h"
 #include "grep.h"
 #include "notes.h"
+#include "dir.h"
 
 #define SEEN		(1u<<0)
 #define UNINTERESTING   (1u<<1)
@@ -133,6 +134,7 @@ struct rev_info {
 	/* diff info for patches and for paths limiting */
 	struct diff_options diffopt;
 	struct diff_options pruning;
+	struct exclude_list el;
 
 	struct reflog_walk_info *reflog_info;
 	struct decoration children;
-- 
1.7.3.1.256.g2539c.dirty
Previous: Nguyễn Thái Ngọc DuyNext: Matthieu Moy
Message 4 of 12 in “git log --exclude”
  1. 0/3 git log --excludeNguyễn Thái Ngọc Duy, Oct 5, 2011
  2. 1/3 diff-no-index: rename read_directory to avoid conflict from dir.hNguyễn Thái Ngọc Duy, Oct 5, 2011
  3. 2/3 tree-diff: teach it to understand exclude patternsNguyễn Thái Ngọc Duy, Oct 5, 2011
  4. 3/3 log: add --exclude optionNguyễn Thái Ngọc Duy, Oct 5, 2011
  5. Matthieu MoyOct 5, 2011
  6. Nguyen Thai Ngoc DuyOct 5, 2011
  7. Junio C HamanoOct 5, 2011
  8. Jeff KingOct 6, 2011
  9. Junio C HamanoOct 6, 2011
  10. Nguyen Thai Ngoc DuyOct 6, 2011
  11. Nguyen Thai Ngoc DuyOct 7, 2011
  12. Junio C HamanoOct 7, 2011

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.