aboutsummaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2007-01-11 11:47:48 +0100
committerJunio C Hamano <junkio@cox.net>2007-01-20 21:32:31 -0800
commit8860fd42fcf5a7853f7d7c2198793183320293ff (patch)
tree24b6d67b95ef9efe285a4cb1f71d77edc5ef1834 /revision.c
parentbcf316187699c5e97bf47c1b8a00c844bf809fbc (diff)
downloadgit-8860fd42fcf5a7853f7d7c2198793183320293ff.tar.gz
git-8860fd42fcf5a7853f7d7c2198793183320293ff.tar.xz
Teach the revision walker to walk by reflogs with --walk-reflogs
When called with "--walk-reflogs", as long as there are reflogs available, the walker will take this information into account, rather than the parent information in the commit object. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/revision.c b/revision.c
index f2ddd95e2..ebd025064 100644
--- a/revision.c
+++ b/revision.c
@@ -7,6 +7,7 @@
#include "refs.h"
#include "revision.h"
#include "grep.h"
+#include "reflog-walk.h"
static char *path_name(struct name_path *path, const char *name)
{
@@ -116,6 +117,9 @@ void mark_parents_uninteresting(struct commit *commit)
void add_pending_object(struct rev_info *revs, struct object *obj, const char *name)
{
add_object_array(obj, name, &revs->pending);
+ if (revs->reflog_info && obj->type == OBJ_COMMIT)
+ add_reflog_for_walk(revs->reflog_info,
+ (struct commit *)obj, name);
}
static struct object *get_reference(struct rev_info *revs, const char *name, const unsigned char *sha1, unsigned int flags)
@@ -864,6 +868,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
handle_reflog(revs, flags);
continue;
}
+ if (!strcmp(arg, "--walk-reflogs")) {
+ init_reflog_walk(&revs->reflog_info);
+ continue;
+ }
if (!strcmp(arg, "--not")) {
flags ^= UNINTERESTING;
continue;
@@ -1210,6 +1218,9 @@ static struct commit *get_revision_1(struct rev_info *revs)
revs->commits = entry->next;
free(entry);
+ if (revs->reflog_info)
+ fake_reflog_parent(revs->reflog_info, commit);
+
/*
* If we haven't done the list limiting, we need to look at
* the parents here. We also need to do the date-based limiting