Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
gps: handle symlinks properly
Browse files Browse the repository at this point in the history
We now delete anything that looks like a symlink if its called
"vendor" while pruning.

Hopefully, you didn't make a bad decision by relying on the magical
properties of symlinks.

Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
  • Loading branch information
ibrasho committed Dec 10, 2017
1 parent 07a486b commit a6ad0cc
Show file tree
Hide file tree
Showing 2 changed files with 208 additions and 224 deletions.
8 changes: 2 additions & 6 deletions gps/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,9 @@ func deriveFilesystemState(root string) (filesystemState, error) {
l := fsLink{path: relPath}

l.to, err = filepath.EvalSymlinks(path)
if strings.HasSuffix(err.Error(), "too many links") {
if err != nil && strings.HasSuffix(err.Error(), "too many links") {
l.circular = true
} else if err != nil {
return err
}

if _, err := os.Stat(l.to); os.IsNotExist(err) {
} else if err != nil && os.IsNotExist(err) {
l.broken = true
} else if err != nil {
return err
Expand Down
Loading

0 comments on commit a6ad0cc

Please sign in to comment.