Skip to content

t6042: fix breakage on Windows

Johannes Schindelin via GitGitGadget git 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest1 patch 1 replyIn review
  2. v11 patch 6 repliesSuperseded

Changes in v2 from the cover letter

* Clarified the change in the commit message.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1t6042: work around speed optimization on Windowst/t6042-merge-rename-corner-cases.sh+2 -21 reply

Reviews trailers per patch

The patch has a Reviewed-by or Acked-by.

PatchElijah Newren
1/1R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/1] t6042: fix breakage on Windows

Unfortunately, Travis decided to change some things under the hood that affect the Windows build. As a consequence, master has not been tested in quite a while, even if the test runs pretended that it had been tested :-(

So imagine my surprise when master simply would refuse to pass the test suite cleanly outside Travis, always failing at t6042, despite the fact that Travis passed.

It turns out that two files are written too quickly in succession, running into the issue where Git for Windows chooses not to populate the inode and device numbers in the stat data (this is a noticeable performance optimization). As a consequence, Git thinks the file is unchanged, and fails to pick up a modification. And no, we cannot simply undo the performance optimization, it would make things prohibitively slow in particular in large worktrees, and it is not like the bug is likely to be hit in reality: for Git to be fooled into thinking that a file is unchanged, it has to be written with the same file size, and within a 100ns time bucket (it is pretty improbable that there is any real-world scenario that would run into that, except of course our regression test suite).

This patch works around this issue by forcing Git to recognize the new file versions as new files (which they really are: the patch simply replaces

git mv <old> <new> && mv <file> <new> && git add <new>`

by

git rm <old> && mv <file> <new> && git add <new>`

which is not shorter, but even a performance improvement (an unnoticeable one, of course).

Changes since v1:

* Clarified the change in the commit message.

Johannes Schindelin (1):
t6042: work around speed optimization on Windows

 t/t6042-merge-rename-corner-cases.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

base-commit: 77556354bb7ac50450e3b28999e3576969869068
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-109%2Fdscho%2Ffix-t6042-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-109/dscho/fix-t6042-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/109

Range-diff vs v1:

1: 598de6652c ! 1: 55b0a641d4 t6042: work around speed optimization on Windows
@@ -35,6 +35,12 @@
now add the files as new files (as opposed to existing, just renamed files).

+ Functionally, we do not change anything because we replace two `git mv
+ <old> <new> calls (where <new> is completely overwritten and git
+ added later anyway) by git rm <old>` calls (removing other files, too,
+ that are also completely overwritten and git added later).
+
+ Reviewed-by: Elijah Newren <[email protected]>

diff --git a/t/t6042-merge-rename-corner-cases.sh b/t/t6042-merge-rename-corner-cases.sh

Signature · 1 line
gitgitgadget