diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-27 12:51:59 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-11-04 00:08:03 -0800 |
commit | 0f3a290b89b89bb5375cf5019b067e4a99f02620 (patch) | |
tree | f1d7a3f846476cb7e027637e2c0826f525ec7637 /revision.c | |
parent | 9f8f132621faedd250fded3e260402623da91a6f (diff) | |
download | git-0f3a290b89b89bb5375cf5019b067e4a99f02620.tar.gz |
Add a 'source' decorator for commits
We already support decorating commits by tags or branches that point to
them, but especially when we are looking at multiple branches together,
we sometimes want to see _how_ we reached a particular commit.
We can abuse the '->util' field in the commit to keep track of that as
we walk the commit lists, and get a reasonably useful view into which
branch or tag first reaches that commit.
Of course, if the commit is reachable through multiple sources (which is
common), our particular choice of "first" reachable is entirely random
and depends on the particular path we happened to follow.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r-- | revision.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/revision.c b/revision.c index 2f646deab0..d45f05a00c 100644 --- a/revision.c +++ b/revision.c @@ -199,6 +199,8 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object mark_parents_uninteresting(commit); revs->limited = 1; } + if (revs->show_source && !commit->util) + commit->util = (void *) name; return commit; } @@ -484,6 +486,8 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit, if (parse_commit(p) < 0) return -1; + if (revs->show_source && !p->util) + p->util = commit->util; p->object.flags |= left_flag; if (!(p->object.flags & SEEN)) { p->object.flags |= SEEN; |