Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
modulo11 committed Sep 5, 2024
1 parent 3f67f0f commit a5d98b2
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions pkg/cnbutils/copy_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,22 @@ func CopyProject(source, target string, include, exclude *ignore.GitIgnore, util
return err
}

if isSymlink && !isDir {
if isSymlink {
linkTarget, err := utils.Readlink(sourceFile)
if err != nil {
return err
}
log.Entry().Debugf("Creating symlink from %s to %s", linkTarget, target)
err = utils.Symlink(linkTarget, target)
if err != nil {
return err
}
} else if isSymlink && !follow {
linkTarget, err := utils.Readlink(sourceFile)
if err != nil {
return err
if !isDir || !follow {
log.Entry().Debugf("Creating symlink from %s to %s", linkTarget, target)
err = utils.Symlink(linkTarget, target)
if err != nil {
return err
}
}
log.Entry().Debugf("Creating symlink from %s to %s", linkTarget, target)
err = utils.Symlink(linkTarget, target)
if err != nil {
return err
if !follow {
log.Entry().Debugf("Adding %s to list of known symlinks", sourceFile)
knownSymlinks = append(knownSymlinks, sourceFile)
}
knownSymlinks = append(knownSymlinks, sourceFile)
} else if isDir {
log.Entry().Debugf("Creating directory %s", target)
err = utils.MkdirAll(target, os.ModePerm)
Expand Down

0 comments on commit a5d98b2

Please sign in to comment.