{"thread":{"id":"961","subject":"[PATCH 1/2] Test case that demonstrates problem with --merge-order, --max-age interaction","startedAt":"2005-06-16T22:26:15Z","lastAt":"2005-06-16T22:26:15Z","messageCount":1,"participants":["Jon Seymour"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"4996","messageId":"20050616222615.18213.qmail@blackcubes.dyndns.org","threadId":"961","inReplyTo":null,"subject":"[PATCH 1/2] Test case that demonstrates problem with --merge-order, --max-age interaction","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2005-06-16T22:26:15Z","receivedAt":"2005-06-16T22:26:15Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"\nThe t/t6001-rev-list-merge-order.sh test case has been modified to demonstrate\na problem with the interaction of the merge_order and max-age flags.\n\nThe problem was first reported by Paul Mackerras on the linux-2.6 repository\n\n$> git-rev-list --max-age=1116330140 bcfff0b471a60df350338bcd727fc9b8a6aa54b2 | wc -l\n655\n$> git-rev-list --merge-order --max-age=1116330140 bcfff0b471a60df350338bcd727fc9b8a6aa54b2 | wc -l\n173\n\nThe problem is that --merge-order is aborting the scan too early when it\nencounters an old commit that happens to sort first because of its\nmerge order.\n\nNote: Test 10 is expected to fail in this patch - there is actually a problem.\nA subsequent patch in this series will fix this problem.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n\n t/t6001-rev-list-merge-order.sh |   83 ++++++++++++++++++++++++++++++---------\n 1 files changed, 63 insertions(+), 20 deletions(-)\n\ndiff --git a/t/t6001-rev-list-merge-order.sh b/t/t6001-rev-list-merge-order.sh\nold mode 100644\nnew mode 100755\n--- a/t/t6001-rev-list-merge-order.sh\n+++ b/t/t6001-rev-list-merge-order.sh\n@@ -9,7 +9,15 @@ test_description='Test rev-list --merge-\n \n function do_commit\n {\n-    git-commit-tree \"$@\" </dev/null\n+    _text=$1\n+    shift 1\n+    (\n+cat <<EOF\n+title $_text\n+\n+A description.\n+EOF\n+    )   | git-commit-tree \"$@\"\n }\n \n function check_adjacency\n@@ -36,31 +44,38 @@ function sed_script\n    done\n }\n \n+\n+function on_committer_date {\n+    _date=$1\n+    shift 1\n+    GIT_COMMITTER_DATE=$_date \"$@\"\n+}\n+\n date >path0\n git-update-cache --add path0\n tree=$(git-write-tree)\n-root=$(do_commit $tree 2>/dev/null)\n+root=$(on_committer_date \"1971-08-16 00:00\" do_commit root $tree 2>/dev/null)\n export GIT_COMMITTER_NAME=foobar  # to guarantee that the commit is different\n-l0=$(do_commit $tree -p $root)\n-l1=$(do_commit $tree -p $l0)\n-l2=$(do_commit $tree -p $l1)\n-a0=$(do_commit $tree -p $l2)\n-a1=$(do_commit $tree -p $a0)\n+l0=$(on_committer_date \"1971-08-16 00:01\" do_commit l0 $tree -p $root)\n+l1=$(on_committer_date \"1971-08-16 00:02\" do_commit l1 $tree -p $l0)\n+l2=$(on_committer_date \"1971-08-16 00:03\" do_commit l2 $tree -p $l1)\n+a0=$(on_committer_date \"1971-08-16 00:04\" do_commit a0 $tree -p $l2)\n+a1=$(on_committer_date \"1971-08-16 00:05\" do_commit a1 $tree -p $a0)\n export GIT_COMMITTER_NAME=foobar2 # to guarantee that the commit is different\n-b1=$(do_commit $tree -p $a0)\n-c1=$(do_commit $tree -p $b1)\n+b1=$(on_committer_date \"1971-08-16 00:06\" do_commit b1 $tree -p $a0)\n+c1=$(on_committer_date \"1971-08-16 00:07\" do_commit c1 $tree -p $b1)\n export GIT_COMMITTER_NAME=foobar3 # to guarantee that the commit is different\n-b2=$(do_commit $tree -p $b1)\n-b3=$(do_commit $tree -p $b2)\n-c2=$(do_commit $tree -p $c1 -p $b2)\n-c3=$(do_commit $tree -p $c2)\n-a2=$(do_commit $tree -p $a1)\n-a3=$(do_commit $tree -p $a2)\n-b4=$(do_commit $tree -p $b3 -p $a3)\n-a4=$(do_commit $tree -p $a3 -p $b4 -p $c3)\n-l3=$(do_commit $tree -p $a4)\n-l4=$(do_commit $tree -p $l3)\n-l5=$(do_commit $tree -p $l4)\n+b2=$(on_committer_date \"1971-08-16 00:08\" do_commit b2 $tree -p $b1)\n+b3=$(on_committer_date \"1971-08-16 00:09\" do_commit b3 $tree -p $b2)\n+c2=$(on_committer_date \"1971-08-16 00:10\" do_commit c2 $tree -p $c1 -p $b2)\n+c3=$(on_committer_date \"1971-08-16 00:11\" do_commit c3 $tree -p $c2)\n+a2=$(on_committer_date \"1971-08-16 00:12\" do_commit a2 $tree -p $a1)\n+a3=$(on_committer_date \"1971-08-16 00:13\" do_commit a3 $tree -p $a2)\n+b4=$(on_committer_date \"1971-08-16 00:14\" do_commit b4 $tree -p $b3 -p $a3)\n+a4=$(on_committer_date \"1971-08-16 00:15\" do_commit a4 $tree -p $a3 -p $b4 -p $c3)\n+l3=$(on_committer_date \"1971-08-16 00:16\" do_commit l3 $tree -p $a4)\n+l4=$(on_committer_date \"1971-08-16 00:17\" do_commit l4 $tree -p $l3)\n+l5=$(on_committer_date \"1971-08-16 00:18\" do_commit l5 $tree -p $l4)\n echo $l5 > .git/HEAD\n \n git-rev-list --merge-order --show-breaks HEAD | sed \"$(sed_script)\" > actual-merge-order\n@@ -172,4 +187,32 @@ test_expect_success 'Testing duplicated \n \n test_expect_success 'Testing exclusion near merge' 'git-rev-list --merge-order $a4 ^$c3 2>/dev/null'\n \n+\n+cat > expected-merge-order-6 <<EOF\n+l5\n+l4\n+l3\n+a4\n+b4\n+a3\n+a2\n+c3\n+EOF\n+git-rev-list --max-age=51149460 $l5 | sed \"$(sed_script)\" > actual-merge-order-6\n+test_expect_success 'Testing --max-age=c3 (no --merge-order)' 'diff expected-merge-order-6 actual-merge-order-6'\n+\n+cat > expected-merge-order-7 <<EOF\n+l5\n+l4\n+l3\n+a4\n+c3\n+b4\n+a3\n+a2\n+EOF\n+\n+git-rev-list --merge-order --max-age=51149460 $l5 | sed \"$(sed_script)\" > actual-merge-order-7\n+test_expect_success 'Testing --max-age=c3, --merge-order' 'diff expected-merge-order-7 actual-merge-order-7'\n+\n test_done\n------------\n"}]}