Subject: [PATCH 3/5] revision.c: allow to change pseudo opt parsing function

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Wed, 25 Jan 2017 19:50:52 +0700

Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
---
 revision.c | 11 ++++++++---
 revision.h |  4 ++++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/revision.c b/revision.c
index 6ebd38d1c8..cda2606c66 100644
--- a/revision.c
+++ b/revision.c
@@ -2273,10 +2273,15 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
 		const char *arg = argv[i];
 		if (*arg == '-') {
 			int opts;
+			handle_pseudo_opt_cb handle_pseudo_opt =
+				handle_revision_pseudo_opt;
 
-			opts = handle_revision_pseudo_opt(submodule,
-						revs, argc - i, argv + i,
-						&flags);
+			if (revs->handle_pseudo_opt)
+				handle_pseudo_opt = revs->handle_pseudo_opt;
+
+			opts = handle_pseudo_opt(submodule,
+						 revs, argc - i, argv + i,
+						 &flags);
 			if (opts > 0) {
 				i += opts - 1;
 				continue;
diff --git a/revision.h b/revision.h
index 9fac1a607d..9080eaf381 100644
--- a/revision.h
+++ b/revision.h
@@ -52,6 +52,8 @@ struct rev_cmdline_info {
 #define REVISION_WALK_NO_WALK_SORTED 1
 #define REVISION_WALK_NO_WALK_UNSORTED 2
 
+typedef int (*handle_pseudo_opt_cb)(const char *, struct rev_info *, int, const char **, int *);
+
 struct rev_info {
 	/* Starting list */
 	struct commit_list *commits;
@@ -213,6 +215,8 @@ struct rev_info {
 
 	struct commit_list *previous_parents;
 	const char *break_bar;
+
+	handle_pseudo_opt_cb handle_pseudo_opt;
 };
 
 extern int ref_excluded(struct string_list *, const char *path);
-- 
2.11.0.157.gd943d85