Allow symlinks in gh-pages
Closed this issue · 3 comments
For a strange use case, we have a gh-pages directory that requires a symlink. The symlink is fine in the build directory, but never comes across when using gh-pages.
In my quick read of the code, I can't see anything obvious that would allow us to bring symlinks across. It would be great if this could be supported
os.walk doesn't follow symlinks by default. If you want to add a PR to make that an option I'd be willing to add that.
I had to reorganize some other things and this became an easy add so ghp-import now supports passing -l on the command line to follow symlinks out of your docs directory.
I had to reorganize some other things and this became an easy add
For reference, the commit was cb1dd9a.
ghp-import now supports passing -l on the command line to follow symlinks out of your docs directory.
This is not a great description of the current behavior of --follow-links
. Neither is the help message:
Or the README mention:
The
-l
option will cause the import to follow symlinks for users that have odd configurations that include symlinking outside of their documentation directory.
Here is where --follow-links
has an effect in the code:
Specifically, it is passed through to os.walk
, whose documentation states:
By default,
walk()
will not walk down into symbolic links that resolve to directories. Set followlinks toTrue
to visit directories pointed to by symlinks, on systems that support them.
Note: Be aware that setting followlinks toTrue
can lead to infinite recursion if a link points to a parent directory of itself.walk()
does not keep track of the directories it visited already.
So from reading this, I believe the behavior of ghp-import without --follow-links is to follow symlinks for files but not directories. With --follow-links, the behavior is follow symlinks for files and directories.
I'm going to open another issue regarding symlinks, but wanted to understand the current behavior first, hence posting to this issue.