Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FunctionalTests: use rename(2) for files on POSIX
On macOS and Linux platforms, we use rename(2) directly when moving files with the SystemIORunner's MoveFile() method, instead of using .NET Core's File.Move() method. The latter actually implements most file moves using a combination of link(2) followed by unlink(2) on the source file. The consequence of using link() instead of rename() is that on recent versions of macOS, when running with Watchman, file creation events may not be delivered by Watchman to Git when a new hard link within the Git working tree is created if that link points to an existing inode outside of the watched tree. This in turn causes the MoveFileFromOutsideRepoToInsideRepoAndAdd() test in GitCommandsTests to fail intermittently. We can work around the problem by utilizing rename() directly, which also parallels the behaviour of SystemIORunner's RenameDirectory() method, added in commit 0a517fa. See also: facebook/watchman#858 https://github.com/dotnet/runtime/blob/94515f7bd34aabaab5ba6a1316f4a881cbf2370c/src/libraries/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs#L142-L144
- Loading branch information