diff options
| author | Karsten Blees <karsten.blees@gmail.com> | 2026-01-09 20:05:12 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-01-09 18:32:55 -0800 |
| commit | 97be7aa43a711646e66e1b11b43624e0940fe278 (patch) | |
| tree | b2971b0ec4693fb8e1ee970695d1a5e3e8c0f602 /contrib/persistent-https | |
| parent | mingw: implement basic `symlink()` functionality (file symlinks only) (diff) | |
| download | git-97be7aa43a711646e66e1b11b43624e0940fe278.tar.gz git-97be7aa43a711646e66e1b11b43624e0940fe278.zip | |
mingw: add support for symlinks to directories
Symlinks on Windows have a flag that indicates whether the target is a
file or a directory. Symlinks of wrong type simply don't work. This even
affects core Win32 APIs (e.g. `DeleteFile()` refuses to delete directory
symlinks).
However, `CreateFile()` with FILE_FLAG_BACKUP_SEMANTICS does work. Check
the target type by first creating a tentative file symlink, opening it,
and checking the type of the resulting handle. If it is a directory,
recreate the symlink with the directory flag set.
It is possible to create symlinks before the target exists (or in case
of symlinks to symlinks: before the target type is known). If this
happens, create a tentative file symlink and postpone the directory
decision: keep a list of phantom symlinks to be processed whenever a new
directory is created in `mingw_mkdir()`.
Limitations: This algorithm may fail if a link target changes from file
to directory or vice versa, or if the target directory is created in
another process. It's the best Git can do, though.
Signed-off-by: Karsten Blees <karsten.blees@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/persistent-https')
0 files changed, 0 insertions, 0 deletions
