@@ -198,6 +198,33 @@ git commit -q -m c14.2
198
198
199
199
git merge branch-that-has-one-of-the-changes || true
200
200
201
+ # This is to verify that, even though commits `c15`, `c15.1` and `merge` are
202
+ # not chronologically ordered (`c15.1` has a `CommitDate` that is before
203
+ # `c15`’s `CommitDate`), the resulting blame is still correct.
204
+ #
205
+ # ---c15------c15.2
206
+ # \ \
207
+ # c15.1----merge
208
+ echo -e " line 1\nline 2\n line 3" > file-topo-order-different-than-date-order.txt
209
+ git add file-topo-order-different-than-date-order.txt
210
+ git commit -q -m c15
211
+
212
+ git checkout -b branch-that-has-earlier-commit
213
+
214
+ echo -e " line 1\nline 2\n line 3 changed" > file-topo-order-different-than-date-order.txt
215
+ git add file-topo-order-different-than-date-order.txt
216
+ # `GIT_COMMITTER_DATE` is set to "2000-01-02 00:00:00 +0000" in
217
+ # `tests/tools/src/lib.rs` and is the default `CommitDate` used in
218
+ # `make_blame_repo.sh`.
219
+ GIT_COMMITTER_DATE=" 1999-12-31 00:00:00 +0000" git commit -q -m c15.1
220
+
221
+ git checkout main
222
+ echo -e " line 1 changed\nline 2\n line 3" > file-topo-order-different-than-date-order.txt
223
+ git add file-topo-order-different-than-date-order.txt
224
+ git commit -q -m c15.2
225
+
226
+ git merge branch-that-has-earlier-commit || true
227
+
201
228
git blame --porcelain simple.txt > .git/simple.baseline
202
229
git blame --porcelain -L 1,2 simple.txt > .git/simple-lines-1-2.baseline
203
230
git blame --porcelain multiline-hunks.txt > .git/multiline-hunks.baseline
@@ -217,6 +244,7 @@ git blame --porcelain file-in-one-chain-of-ancestors.txt > .git/file-in-one-chai
217
244
git blame --porcelain different-file-in-another-chain-of-ancestors.txt > .git/different-file-in-another-chain-of-ancestors.baseline
218
245
git blame --porcelain file-only-changed-in-branch.txt > .git/file-only-changed-in-branch.baseline
219
246
git blame --porcelain file-changed-in-two-branches.txt > .git/file-changed-in-two-branches.baseline
247
+ git blame --porcelain file-topo-order-different-than-date-order.txt > .git/file-topo-order-different-than-date-order.baseline
220
248
221
249
git blame --porcelain empty-lines-histogram.txt > .git/empty-lines-histogram.baseline
222
250
0 commit comments