Skip to content

Enable support for long paths

What does this MR do?

Enabled longpaths option for Git client which is installed inside a Windows helper image. This option allows Git to handle long paths, for example, during performing cleanup. Without this option some predefined steps during a job execution may fail.

Why was this MR needed?

Without this change Git is not capable of performing cleanup inside a working directory which contains items with long paths. GitLab Runner puts a full project path to a working directory path. Project name itself may be long. In my case CMake is used which creates nested directories with long paths which can not be later removed by Git.

With a default helper image jobs constantly fail with the following error:

Fetching changes...
Reinitialized existing Git repository in c:/builds/xxxxxxxxxxx/products/xxxxxxxxxxxxxxxxxxxxxx/.git/
Checking out ba9e958c as master...
warning: Could not stat path 'build/xxxx_xxxxxxxxxxxxxxxxxxxxxx_win64_x64_release/samples/xxxxx/sample_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx/sample_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx.dir/Release/sample_h.894E97EA.tlog/sample_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx.lastbuildstate': Filename too long
warning: Could not stat path 'build/xxxx_xxxxxxxxxxxxxxxxxxxxxx_win64_x64_release/samples/xxxxx/sample_xxxxxxxxxxxxxxxxxxxxxxxxxxxx/sample_xxxxxxxxxxxxxxxxxxxxxxxxxxxx.dir/Release/sample_h.150D6180.tlog/sample_xxxxxxxxxxxxxxxxxxxxxxxxxxxx.lastbuildstate': Filename too long

After enabling longpaths option everything works smoothly:

Fetching changes...
Reinitialized existing Git repository in c:/builds/xxxxxxxxxxx/products/xxxxxxxxxxxxxxxxxxxxxx/.git/
Checking out ba9e958c as master...
Removing build/demo_xxxxxxxxxxxxxxxxxxxxxx_win64_x64_release/
git-lfs/2.7.1 (GitHub; windows amd64; go 1.11.5; git 6b7fb6e3)

Skipping Git submodules setup

longpaths option is not enabled by default because there are some risks: https://github.com/msysgit/git/pull/122#issuecomment-36782101

But seems like in our case it should not cause any problems because there are only Git and the helper binary inside the helper image.

Are there points in the code the reviewer needs to double check?

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Added tests for this feature/bug
  • In case of conflicts with master - branch was rebased

What are the relevant issue numbers?

#4389 (closed)

Edited by Steve Xuereb

Merge request reports