A difference in behaviour between Linux and Windows Shell runner with timestamps on zero-byte files being updated on Windows
Summary
Selected bug but this may be expected behaviour, a customer was surprised that there was a difference in behaviour.
Customer use case is that having mtime updated confuses what has actually changed, using tooling pyinstaller
.
Using Linux and Window (both powershell, pwsh) Shell runners:
- Linux - we have
Reinitialized existing Git repository in /home/gitlab-runner/builds/sz7Seukcw/0/group-cicd/project-checking-mtime-update-for-zero-byte-files/.git/
$ date
Mon Aug 21 **04:19:14** UTC 2023
$ ls -laRh
...
-rw-rw-r-- 1 gitlab-runner gitlab-runner 0 Aug 21 **04:01** zero-byte-file.txt #### This is unchanged
- Windows
Reinitialized existing Git repository in C:/GitLab-Runner/builds/dx8kNCxZs/0/group-cicd/project-checking-mtime-update-for-zero-byte-files/.git/
$ date
Tuesday, August 22, 2023 **4:09:40** AM
$ ls
LastWriteTime : 8/22/2023 **4:09:39** AM #### This is changed
Length : 0
Name : zero-byte-file.txt
Why the difference in behaviour?
Can this behaviour be controlled via a setting (git config or ?)?
Steps to reproduce
- Create two shell runners - Linux, Windows
- Create a project containing a zero-byte file.
- Run two pipelines for each Runner, the first will initialise the repository, the second will reinitialise - showing the difference in behaviour
Environment description
Self-hosted Shell runners (16.2.1)