Bodenseematze
Bodenseematze

Reputation: 33

git (windows): can I prevent git from changing my symlink type from "directory" to "normal" when checking out?

I'm on Windows 10 and have globally set "git config --global core.symlinks true".

I have a repository (repA) with a submodule (repB) in which is another submodule (repC).
In the main directory of the submodule repB I created several symbolic links to files and directories inside the submodule repC

When I clone the whole repository or switch / checkout to another branch, git seems to first checkout submodule repB and then repC because the directory symlinks are changed by git to be normal file symlinks.
When I remove the wrong file symlinks and then revert that change it correctly recreates the symlinks as directory symlinks.

So how can I tell git that it either first checks out repC and then creates the symlinks in repB or to not automatically change the type of symlinks from "directory" to normal file?
Is there any config option for that?

I created a file symlink with e.g. "mklink file1 repC\file1" (symbolic link to file) or "mklink /d dir1 repC\dir1" (symbolic link to directory).
This is how it should look after proper checkout (AL/DL are the Attributes of the files):

repA\
  repB\
     file1 -> repC\file1            (AL)
     dir1  -> repC\dir1\            (DL)
  repC\
    file1
    dir1\

And this is how it looks after cloning repA:

repA\
  repB\
    file1 -> repC\file1           (AL)
    dir1  -> repC\dir1            (AL)
  repC\
    file1
    dir1\

I clone it with "git clone -c core.symlinks=true --tags -b mybranch --recurse-submodules --remote-submodules"

The same happens when I switch to another branch (with different symlinks)

Upvotes: 0

Views: 23

Answers (0)

Related Questions