git: check-in a file in a symlink directory fails

28 viewsgitlinuxsymlink
0

I have a project directory with regular-files and generated-files by a tool.
The generated-files are as important as the regular-files → I want to have the generated-files in the git repository too.

the problem is that I use a build-directory in a memory-file-system and a source-directory on a regular-file-system. the generated-files are in a subdirectory of the build-file-system called gen and the gen is soft-link to the source-file-system

build

...
gen/libsq3sqlite3.meta
...

source

...
gen -> /path/to/build/gen
...

If I do a git add gen/libsq3sqlite3.meta I get the error message

  • fatal: pathspec ‘gen/libsq3sqlite3.meta’ is beyond a symbolic link

If I do a readlink -f gen/libsq3sqlite3.meta first I get the real path

  • /some/real/path/to/gen/libsq3sqlite3.meta

And if I use this real-path I get

  • fatal: /some/real/path/to/gen/libsq3sqlite3.meta: ‘/some/real/path/to/gen/libsq3sqlite3.meta’ is outside repository at ‘/my/rep/project’

I want to have

  1. git should accept the gen-subdirectory as regular-directory
  2. git should treat every file in the gen-subdirectory as regular-file
  3. git should treat the gen-subdirectory always relative to the source-directory and always use the source-directory-path of the file and not the build-directory-path