t3427: move the `filter-branch` invocation into the `setup` case

The step to prepare a pre-rebase commit history is _identical_ in _all_ of the test cases (except of course the `setup` case). It should therefore clearly a part of the `setup` test case instead. As the `git filter-branch` command is quite costly on platforms where Unix shell scripting is simply slow (meaning: on Windows), this shaves off a noticeable part of the runtime: in this developer's setup, the time was reduced from ~1m25s to ~1m. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jul 31, 2019 at 08:18 UTC d51b771dc0a2ea71c44f3c4c54230f140588bacd
1 file changed +13 -25
t/t3427-rebase-subtree.sh
+13 -25
@@ -56,16 +56,18 @@ test_expect_success 'setup' '
56
57 : add two extra commits to rebase &&
58 test_commit -C files_subtree master4 &&
59 - test_commit files_subtree/master5
59 + test_commit files_subtree/master5 &&
60 +
61 + git checkout -b to-rebase &&
62 + git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
63 + git commit -m "Empty commit" --allow-empty
64 '
65
66 # FAILURE: Does not preserve master4.
67 test_expect_failure REBASE_P \
68 'Rebase -Xsubtree --preserve-merges --onto commit 4' '
69 reset_rebase &&
66 - git checkout -b rebase-preserve-merges-4 master &&
67 - git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
68 - git commit -m "Empty commit" --allow-empty &&
70 + git checkout -b rebase-preserve-merges-4 to-rebase &&
71 git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master &&
72 verbose test "$(commit_message HEAD~)" = "files_subtree/master4"
73 '
@@ -74,9 +76,7 @@ test_expect_failure REBASE_P \
76 test_expect_failure REBASE_P \
77 'Rebase -Xsubtree --preserve-merges --onto commit 5' '
78 reset_rebase &&
77 - git checkout -b rebase-preserve-merges-5 master &&
78 - git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
79 - git commit -m "Empty commit" --allow-empty &&
79 + git checkout -b rebase-preserve-merges-5 to-rebase &&
80 git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master &&
81 verbose test "$(commit_message HEAD)" = "files_subtree/master5"
82 '
@@ -85,9 +85,7 @@ test_expect_failure REBASE_P \
85 test_expect_failure REBASE_P \
86 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit 4' '
87 reset_rebase &&
88 - git checkout -b rebase-keep-empty-4 master &&
89 - git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
90 - git commit -m "Empty commit" --allow-empty &&
88 + git checkout -b rebase-keep-empty-4 to-rebase &&
89 git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master &&
90 verbose test "$(commit_message HEAD~2)" = "files_subtree/master4"
91 '
@@ -96,9 +94,7 @@ test_expect_failure REBASE_P \
94 test_expect_failure REBASE_P \
95 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit 5' '
96 reset_rebase &&
99 - git checkout -b rebase-keep-empty-5 master &&
100 - git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
101 - git commit -m "Empty commit" --allow-empty &&
97 + git checkout -b rebase-keep-empty-5 to-rebase &&
98 git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master &&
99 verbose test "$(commit_message HEAD~)" = "files_subtree/master5"
100 '
@@ -107,9 +103,7 @@ test_expect_failure REBASE_P \
103 test_expect_failure REBASE_P \
104 'Rebase -Xsubtree --keep-empty --preserve-merges --onto empty commit' '
105 reset_rebase &&
110 - git checkout -b rebase-keep-empty-empty master &&
111 - git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
112 - git commit -m "Empty commit" --allow-empty &&
106 + git checkout -b rebase-keep-empty-empty to-rebase &&
107 git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master &&
108 verbose test "$(commit_message HEAD)" = "Empty commit"
109 '
@@ -117,9 +111,7 @@ test_expect_failure REBASE_P \
111 # FAILURE: fatal: Could not parse object
112 test_expect_failure 'Rebase -Xsubtree --onto commit 4' '
113 reset_rebase &&
120 - git checkout -b rebase-onto-4 master &&
121 - git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
122 - git commit -m "Empty commit" --allow-empty &&
114 + git checkout -b rebase-onto-4 to-rebase &&
115 git rebase -Xsubtree=files_subtree --onto files-master master &&
116 verbose test "$(commit_message HEAD~2)" = "files_subtree/master4"
117 '
@@ -127,18 +119,14 @@ test_expect_failure 'Rebase -Xsubtree --onto commit 4' '
119 # FAILURE: fatal: Could not parse object
120 test_expect_failure 'Rebase -Xsubtree --onto commit 5' '
121 reset_rebase &&
130 - git checkout -b rebase-onto-5 master &&
131 - git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
132 - git commit -m "Empty commit" --allow-empty &&
122 + git checkout -b rebase-onto-5 to-rebase &&
123 git rebase -Xsubtree=files_subtree --onto files-master master &&
124 verbose test "$(commit_message HEAD~)" = "files_subtree/master5"
125 '
126 # FAILURE: fatal: Could not parse object
127 test_expect_failure 'Rebase -Xsubtree --onto empty commit' '
128 reset_rebase &&
139 - git checkout -b rebase-onto-empty master &&
140 - git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
141 - git commit -m "Empty commit" --allow-empty &&
129 + git checkout -b rebase-onto-empty to-rebase &&
130 git rebase -Xsubtree=files_subtree --onto files-master master &&
131 verbose test "$(commit_message HEAD)" = "Empty commit"
132 '