Skip to content

Ensure git core.longpaths on Windows #1293

@hohwille

Description

@hohwille

On Windows we have several projects that cannot clone their code git repositories properly and get this error many times:

error: unable to create file ... : Filename too long

Git offers a fix or workaround for this problem:
You need to run the following command before creating the project:

git config --system core.longpaths true

However, the idea of IDEasy is that setting up the IDE is easy.
Hence, we should do such things automatically to prevent such errors and increase UX.
Do not ask me why the Git Installer is not doing this out of the box (and also the Windows Terminal integration, etc.) and users always need expert knowledge to get things right.
So we should step in as IDEasy here.

Solution

Somewhere here:

installIdeasyWindowsEnv(ideRoot, installationPath);

We will add a private method to check the git setup.
First of all we should check if git is installed at all (git can be found on the PATH - see #900 for an easy way to do that).
If git is not installed, we should log an ERROR (but proceed):

Git is not installed on your computer but required by IDEasy. Please download and install git:
https://git-scm.com/download/

(Later we can automate that and download and install it automatically for the user)

Next we should do the trick if we are on Windows.
Technically the git config --system command is just modifying the file ~/.gitconfig.
We can read that file and check if

	longpaths = true

Is found in section

[core]

And if not we add it.

It might seem simpler to just call the git config command but we may (later) also check if the following properties are defined:

[user]
	name = ...
	email = ...

If that is not the case, we should ask the user for the values and set them.
Therefore we will need a feature to handle such "ini-files" in IDEasy anyway.
If the PR should be simplified, we can start with git config command and later consider changing that again.
I am just trying to outline more of the future vision.

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

Status

✅ Done

Relationships

None yet

Development

No branches or pull requests

Issue actions