Skip to content

Commit

Permalink
added integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Przybyl committed Oct 7, 2024
1 parent 5abd048 commit 99b93f7
Show file tree
Hide file tree
Showing 78 changed files with 2,454 additions and 4 deletions.
10 changes: 7 additions & 3 deletions pkg/content_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (cm *ContentManager) PullFile(instance *Instance, file string, clean bool,
if err := cm.pullContent(instance, workDir, opts); err != nil {
return err
}
syncFile := DetermineSyncFile(file)
syncFile := DetermineSyncFile(workDir, file)
if file != syncFile || replace {
if err := cm.contentManager.DeleteFile(file, nil); err != nil {
return err
Expand Down Expand Up @@ -139,9 +139,13 @@ func (cm *ContentManager) Copy(srcInstance *Instance, destInstances []Instance,
return nil
}

func DetermineSyncFile(file string) string {
func DetermineSyncFile(workDir string, file string) string {
if regexp.MustCompile(FlattenFilePattern).MatchString(file) {
return filepath.Join(strings.ReplaceAll(file, content.XmlFileSuffix, ""), content.JCRContentFile)
syncFile := filepath.Join(strings.ReplaceAll(file, content.XmlFileSuffix, ""), content.JCRContentFile)
_, jcrPath, _ := strings.Cut(syncFile, content.JCRRoot)
if pathx.Exists(filepath.Join(workDir, content.JCRRoot, jcrPath)) {
return syncFile
}
}
return file
}
Expand Down
Loading

0 comments on commit 99b93f7

Please sign in to comment.