]> git.ipfire.org Git - thirdparty/git.git/commit - revision.c
Simplify and fix --first-parent implementation
authorStephen R. van den Berg <srb@cuci.nl>
Sun, 27 Apr 2008 17:32:46 +0000 (19:32 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 30 Apr 2008 00:47:37 +0000 (17:47 -0700)
commitd9c292e8bbd51c84cb9ecd86cb89b8a1b35a2a82
tree43b2a394017dba66ca78ad2d8ead7e94cde9a4c5
parentf0ec47b8e7f46e17e6b6fe1cead728fa24477e43
Simplify and fix --first-parent implementation

The purpose of --first-parent is to view the tree without looking at
side branche.  This is accomplished by pretending there are no other
parents than the first parent when encountering a merge.

The current code marks the other parents as seen, which means that the tree
traversal will behave differently depending on the order merges are handled.

When a fast forward is artificially recorded as a merge,

       -----
      /     \
 D---E---F---G master

the current first-parent code considers E to be seen and stops the
traversal after showing G and F.

Signed-off-by: Stephen R. van den Berg <srb@cuci.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
revision.c