aboutsummaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2013-10-24 14:01:41 -0400
committerJunio C Hamano <gitster@pobox.com>2013-10-24 15:44:52 -0700
commita330de31d18ca08c773c64e3657b3bafd59cf751 (patch)
tree921d4af50ec640f4b8d9d6b4beb2e1db4a8e97ea /revision.c
parent68fb36eb92ff98ec81a066592a07b3f411450a1d (diff)
downloadgit-a330de31d18ca08c773c64e3657b3bafd59cf751.tar.gz
git-a330de31d18ca08c773c64e3657b3bafd59cf751.tar.xz
revision: allow setting custom limiter function
This commit enables users of `struct rev_info` to peform custom limiting during a revision walk (i.e. `get_revision`). If the field `include_check` has been set to a callback, this callback will be issued once for each commit before it is added to the "pending" list of the revwalk. If the include check returns 0, the commit will be marked as added but won't be pushed to the pending list, effectively limiting the walk. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/revision.c b/revision.c
index 0173e0148..cddd6051e 100644
--- a/revision.c
+++ b/revision.c
@@ -779,6 +779,10 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit,
return 0;
commit->object.flags |= ADDED;
+ if (revs->include_check &&
+ !revs->include_check(commit, revs->include_check_data))
+ return 0;
+
/*
* If the commit is uninteresting, don't try to
* prune parents - we want the maximal uninteresting