Code

[PATCH] Fix for git-rev-list --merge-order B ^A (A,B share common base) [rev 2]
authorJon Seymour <jon.seymour@gmail.com>
Thu, 30 Jun 2005 01:51:34 +0000 (11:51 +1000)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 30 Jun 2005 03:53:10 +0000 (20:53 -0700)
This patch makes --merge-order produce the same list as git-rev-list
without --merge-order specified.

In particular, if the graph looks like this:

A
| B
|/
C
|
D

The both git-rev-list B ^A and git-rev-list --merge-order will produce B.

The unit tests have been changed to reflect the fact that the prune
points are now formally part of the start list that is used to perform
the --merge-order sort.

That is: git-rev-list --merge-order A ^D used to produce

= A
| C

It now produces:

^ A
| C

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
epoch.c
t/t6001-rev-list-merge-order.sh

diff --git a/epoch.c b/epoch.c
index 904cc0d4b89db2307d137a474ab8f555ab67ea12..3cbff72b3bf3f57b0a643762bb9651c8570a6f06 100644 (file)
--- a/epoch.c
+++ b/epoch.c
@@ -585,11 +585,9 @@ int sort_list_in_merge_order(struct commit_list *list, emitter_func emitter)
        for (; list; list = list->next) {
                struct commit *next = list->item;
 
-               if (!(next->object.flags & UNINTERESTING)) {
-                       if (!(next->object.flags & DUPCHECK)) {
-                               next->object.flags |= DUPCHECK;
-                               commit_list_insert(list->item, &reversed);
-                       }
+               if (!(next->object.flags & DUPCHECK)) {
+                       next->object.flags |= DUPCHECK;
+                       commit_list_insert(list->item, &reversed);
                }
        }
 
index 29167e9a7799a2d4a224075f62239717c89981c4..8ac77d997ba99fc564d40e62977fd8f65ef23b8e 100755 (executable)
@@ -367,33 +367,33 @@ test_output_expect_success "three nodes one head, one internal, one base" 'git-r
 EOF
 
 test_output_expect_success "linear prune l2 ^root" 'git-rev-list --merge-order --show-breaks l2 ^root' <<EOF
-= l2
+^ l2
 | l1
 | l0
 EOF
 
 test_output_expect_success "linear prune l2 ^l0" 'git-rev-list --merge-order --show-breaks l2 ^l0' <<EOF
-= l2
+^ l2
 | l1
 EOF
 
 test_output_expect_success "linear prune l2 ^l1" 'git-rev-list --merge-order --show-breaks l2 ^l1' <<EOF
-= l2
+^ l2
 EOF
 
 test_output_expect_success "linear prune l5 ^a4" 'git-rev-list --merge-order --show-breaks l5 ^a4' <<EOF
-= l5
+^ l5
 | l4
 | l3
 EOF
 
 test_output_expect_success "linear prune l5 ^l3" 'git-rev-list --merge-order --show-breaks l5 ^l3' <<EOF
-= l5
+^ l5
 | l4
 EOF
 
 test_output_expect_success "linear prune l5 ^l4" 'git-rev-list --merge-order --show-breaks l5 ^l4' <<EOF
-= l5
+^ l5
 EOF
 
 test_output_expect_success "max-count 10 - merge order" 'git-rev-list --merge-order --show-breaks --max-count=10 l5' <<EOF