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

Unlink deleted files #28

Open
andsens opened this issue May 10, 2013 · 7 comments
Open

Unlink deleted files #28

andsens opened this issue May 10, 2013 · 7 comments

Comments

@andsens
Copy link
Owner

andsens commented May 10, 2013

Homeshick has a check which determines whether the user should be asked about symlinking newly added files.

Similarly we could add an unlink command which removes symlinks to deleted files.

@jrhorn424
Copy link

+1. I'm not sure of etiquette here. Is hitting "watch thread" enough to register my interest, or does the +1 help?

@NemesisRE
Copy link

Since this is still an issue how about something like this in the symlink command:

for deadlink in $(find -xtype l -exec ls -1 {} \;); do
   if [ $(readlink $deadlink | grep ${repo}/home) ]; then
      pending 'deadlink' "$filename"
      rm $deadlink && success || err $EX_ERR "Could not delete $deadlink"
   fi
done

@andsens
Copy link
Owner Author

andsens commented Mar 17, 2014

That would mean you'd have to enumerate everything in $HOME (think people with a /music folder etc.), I think calling git with --diff-filter=D is the more sensible option here. I'll start working on it soon.

@NemesisRE
Copy link

I did much bash scripting the last weeks maybe i was too fixed on finding the solution with bash instead looking into git options.

You are right this is a much better way

@untitaker
Copy link
Contributor

What about removing dead links which symlink to something in a castle?

@andsens
Copy link
Owner Author

andsens commented Jun 26, 2014

What about removing dead links which symlink to something in a castle?

As I said above: You'd have to iterate through everything in the home dir. It's just not feasible.

@andsens
Copy link
Owner Author

andsens commented Feb 11, 2019

I recently had the issue where I was missing the unlink command, though it should probably be called clean. The following would be able to find all files in home/ that have been deleted since a castles inception: git diff --name-only --diff-filter=D $(git log --reverse --pretty=format:%h | head -n1) -- home

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants