Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt whole folders #19

Open
mrkgnao opened this issue Nov 20, 2016 · 2 comments
Open

Adopt whole folders #19

mrkgnao opened this issue Nov 20, 2016 · 2 comments
Labels
adopt Issues with --adopt option enhancement help wanted

Comments

@mrkgnao
Copy link

mrkgnao commented Nov 20, 2016

Allow stow --adopt to adopt a folder if I try to stow a folder that already exists.

@aspiers
Copy link
Owner

aspiers commented Nov 20, 2016

I think that would be too dangerous to enable in general. Whilst a lot of Stow packages share top-level directories such as bin/, lib/, that wouldn't necessarily be a problem because we could make it avoid adopting folders which are already controlled by Stow. But it would often be a problem the first time any package was stowed into a given target directory, e.g. if ~/bin/ or /usr/local/bin already existed and contained files or directories which should not be adopted into the package being stowed.

Maybe we could allow this in carefully controlled circumstances, such as --adopt-folder=bin, but then how is that any better than just doing

mv $target_dir/bin $stow_package

before running a normal stow command? So I'm not convinced the benefits of implementing this outweigh the dangers. However I'm very willing to be persuaded otherwise, if you can give a concrete real-world example which explains your use case!

@aspiers
Copy link
Owner

aspiers commented Jun 28, 2019

Borrowing from ideas in #24, maybe the benefits are worth it after all:

  • verify that the target_dir file is not a symlink (which needs to be smarter, it should actually check if it's a non-stow symlink)
  • verify that the stow_package contains the appropriate parent dirs (essentially mkdir -p $(dirname ...))
  • bail if the directory already exists in the package, rather than accidentally moving the new one from the target directory to underneath the existing one in the package tree.

So I think I'm now persuaded otherwise - pull requests very welcome!

@aspiers aspiers added the adopt Issues with --adopt option label Apr 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adopt Issues with --adopt option enhancement help wanted
Projects
None yet
Development

No branches or pull requests

2 participants