git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] Fix for git-rev-list --merge-order B ^A (A,B share common base)

From
Jon Seymour <jon.seymour@gmail.com>
Date
Jun 29, 2005, 23:45 UTC
Message-ID
<20050629234533.28709.qmail@blackcubes.dyndns.org>

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 test changes in this patch remove use of the --show-breaks flags from certain unit tests. The changed --merge-order behaviour changed the annotation that --show-breaks prints for certain test cases. The new behaviour is reasonable and irrelevant to the intent of the tests so that tests have been changed to eliminate the spurious behaviour.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
---
 epoch.c                         |    8 +++-----
 t/t6001-rev-list-merge-order.sh |   36 ++++++++++++++++++------------------
 2 files changed, 21 insertions(+), 23 deletions(-)
26783f6660e58cc2e988b92050707a6a417cc6ae
diff --git a/epoch.c b/epoch.c
--- a/epoch.c
+++ b/epoch.c
@@ -585,11 +585,9 @@ int sort_list_in_merge_order(struct comm
 	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);
 		}
 	}
 
diff --git a/t/t6001-rev-list-merge-order.sh b/t/t6001-rev-list-merge-order.sh
--- a/t/t6001-rev-list-merge-order.sh
+++ b/t/t6001-rev-list-merge-order.sh
@@ -366,34 +366,34 @@ test_output_expect_success "three nodes 
 = root
 EOF
 
-test_output_expect_success "linear prune l2 ^root" 'git-rev-list --merge-order --show-breaks l2 ^root' <<EOF
-= l2
-| l1
-| l0
+test_output_expect_success "linear prune l2 ^root" 'git-rev-list --merge-order l2 ^root' <<EOF
+l2
+l1
+l0
 EOF
 
-test_output_expect_success "linear prune l2 ^l0" 'git-rev-list --merge-order --show-breaks l2 ^l0' <<EOF
-= l2
-| l1
+test_output_expect_success "linear prune l2 ^l0" 'git-rev-list --merge-order l2 ^l0' <<EOF
+l2
+l1
 EOF
 
-test_output_expect_success "linear prune l2 ^l1" 'git-rev-list --merge-order --show-breaks l2 ^l1' <<EOF
-= l2
+test_output_expect_success "linear prune l2 ^l1" 'git-rev-list --merge-order l2 ^l1' <<EOF
+l2
 EOF
 
-test_output_expect_success "linear prune l5 ^a4" 'git-rev-list --merge-order --show-breaks l5 ^a4' <<EOF
-= l5
-| l4
-| l3
+test_output_expect_success "linear prune l5 ^a4" 'git-rev-list --merge-order l5 ^a4' <<EOF
+l5
+l4
+l3
 EOF
 
-test_output_expect_success "linear prune l5 ^l3" 'git-rev-list --merge-order --show-breaks l5 ^l3' <<EOF
-= l5
-| l4
+test_output_expect_success "linear prune l5 ^l3" 'git-rev-list --merge-order l5 ^l3' <<EOF
+l5
+l4
 EOF
 
-test_output_expect_success "linear prune l5 ^l4" 'git-rev-list --merge-order --show-breaks l5 ^l4' <<EOF
-= l5
+test_output_expect_success "linear prune l5 ^l4" 'git-rev-list --merge-order l5 ^l4' <<EOF
+l5
 EOF
 
 test_output_expect_success "max-count 10 - merge order" 'git-rev-list --merge-order --show-breaks --max-count=10 l5' <<EOF
------------
Next: Junio C Hamano
Message 1 of 4 in “Fix for git-rev-list --merge-order B ^A (A,B share common base)”
  1. 2/2 Fix for git-rev-list --merge-order B ^A (A,B share common base)Jon Seymour, Jun 29, 2005
  2. Junio C HamanoJun 30, 2005
  3. Jon SeymourJun 30, 2005
  4. Jon SeymourJun 30, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.