diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2024-05-23 22:59:49 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2024-05-23 22:59:49 +0300 |
commit | ebda6f466950013d8256fb3eb11c7329af757176 (patch) | |
tree | 1d4e8966ed41a9f28a7df67948086bd3d22eea45 | |
parent | 763819d5b80f46f60a74db7cd79f3ae49e3841b0 (diff) |
Fix
-rw-r--r-- | bpkg/fetch-git.cxx | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/bpkg/fetch-git.cxx b/bpkg/fetch-git.cxx index 87e30fb..f1ebc31 100644 --- a/bpkg/fetch-git.cxx +++ b/bpkg/fetch-git.cxx @@ -2536,15 +2536,24 @@ namespace bpkg // even though .gitattributes indicates that it should. Thus, let's just // remove all the symlinks prior to git-reset on Windows. // -#ifdef _WIN32 +//#ifdef _WIN32 for (const auto& l: find_symlinks (co, dir, prefix)) { - // Note: try_rmsymlink() implementation actually doesn't distinguish - // between the directory and file symlinks. + // Note that we could potentially replace the filesystem-agnostic + // symlinks with hardlinks and thus we need to check the type of a + // filesystem entry prior to the removal. Also note try_rmsymlink() + // implementation actually doesn't distinguish between the directory and + // file symlinks. // - try_rmsymlink (dir / l.first, false /* dir */, true /* ignore_error */); + path p (dir / l.first); + + const auto& e ( + path_entry (p, false /* follow_symlink */, true /* ignore_error */)); + + if (e.first && e.second.type == entry_stat::symlink) + try_rmsymlink (p, false /* dir */, true /* ignore_error */); } -#endif +//#endif // For some (probably valid) reason the hard reset command doesn't remove // a submodule directory that is not plugged into the repository anymore. |