diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index ebf53f5..fd880b0 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -50,6 +50,7 @@ static const char *header_prefix;
static void show_commit(struct commit *commit)
{
+ int i;
if (show_timestamp)
printf("%lu ", commit->date);
if (header_prefix)@@ -86,8 +87,12 @@ static void show_commit(struct commit *commit)
parents = parents->next)
parents->item->object.flags &= ~TMP_MARK;
}
- if (revs.commit_format == CMIT_FMT_ONELINE)
+ if (revs.commit_format == CMIT_FMT_ONELINE) {
putchar(' ');
+ if (revs.indent)
+ for (i = 0; i < commit->level; i++)
+ putchar(' ');
+ }
else
putchar('\n');
diff --git a/commit.h b/commit.h
index 86e8dca..e0e7955 100644
--- a/commit.h
+++ b/commit.h
@@ -17,6 +17,7 @@ struct commit {
struct commit_list *parents;
struct tree *tree;
char *buffer;
+ int level;
};
extern int save_commit_buffer;diff --git a/revision.c b/revision.c
index 0125d41..c965a23 100644
--- a/revision.c
+++ b/revision.c
@@ -372,7 +372,7 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit, str
{
struct commit_list *parent = commit->parents;
unsigned left_flag;
- int add, rest;
+ int add, rest, indent;
if (commit->object.flags & ADDED)
return 0;@@ -421,18 +421,24 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit, str
left_flag = (commit->object.flags & SYMMETRIC_LEFT);
rest = !revs->first_parent_only;
- for (parent = commit->parents, add = 1; parent; add = rest) {
+ for (parent = commit->parents, add = 1, indent = 0; parent; add = rest, indent++) {
struct commit *p = parent->item;
parent = parent->next;
if (parse_commit(p) < 0)
return -1;
p->object.flags |= left_flag;
- if (p->object.flags & SEEN)
+ if (p->object.flags & SEEN) {
+ if (commit->level + indent < p->level) {
+ p->level = commit->level + indent;
+ }
continue;
+ }
p->object.flags |= SEEN;
- if (add)
+ if (add) {
+ p->level = commit->level + indent;
insert_by_date(p, list);
+ }
}
return 0;
}@@ -1080,6 +1086,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
revs->commit_format = get_commit_format(arg+8);
continue;
}
+ if (!strcmp(arg, "--indent")) {
+ revs->indent = 1;
+ continue;
+ }
if (!strcmp(arg, "--root")) {
revs->show_root_diff = 1;
continue;@@ -1252,6 +1262,7 @@ int prepare_revision_walk(struct rev_info *revs)
if (commit) {
if (!(commit->object.flags & SEEN)) {
commit->object.flags |= SEEN;
+ commit->level = 0;
insert_by_date(commit, &revs->commits);
}
}diff --git a/revision.h b/revision.h
index 2845167..2a45955 100644
--- a/revision.h
+++ b/revision.h
@@ -63,7 +63,8 @@ struct rev_info {
/* Format info */
unsigned int shown_one:1,
- abbrev_commit:1;
+ abbrev_commit:1,
+ indent:1;
enum date_mode date_mode;
const char **ignore_packed; /* pretend objects in these are unpacked */--
1.5.2.rc3.88.g9f73-dirty