@@ -22,21 +22,21 @@ type GetWorkspaceConfigResult struct {
22
22
}
23
23
24
24
func FindDevcontainerFiles (ctx context.Context , rawSource , tmpDirPath string , maxDepth int , log log.Logger ) (* GetWorkspaceConfigResult , error ) {
25
- result := & GetWorkspaceConfigResult {ConfigPaths : []string {}}
26
-
27
25
// local path
28
26
isLocalPath , _ := file .IsLocalDir (rawSource )
29
27
if isLocalPath {
30
- return FindFilesInLocalDir (result , rawSource , maxDepth , log )
28
+ return FindFilesInLocalDir (rawSource , maxDepth , log )
31
29
}
32
30
33
31
// git repo
34
32
gitRepository , gitPRReference , gitBranch , gitCommit , gitSubDir := git .NormalizeRepository (rawSource )
35
33
if strings .HasSuffix (rawSource , ".git" ) || git .PingRepository (gitRepository ) {
36
34
log .Debug ("Git repository detected" )
37
- return FindFilesInGitRepo (ctx , result , gitRepository , gitPRReference , gitBranch , gitCommit , gitSubDir , tmpDirPath , maxDepth , log )
35
+ return FindFilesInGitRepo (ctx , gitRepository , gitPRReference , gitBranch , gitCommit , gitSubDir , tmpDirPath , maxDepth , log )
38
36
}
39
37
38
+ result := & GetWorkspaceConfigResult {ConfigPaths : []string {}}
39
+
40
40
// container image
41
41
_ , err := image .GetImage (ctx , rawSource )
42
42
if err == nil {
@@ -50,8 +50,9 @@ func FindDevcontainerFiles(ctx context.Context, rawSource, tmpDirPath string, ma
50
50
return result , nil
51
51
}
52
52
53
- func FindFilesInLocalDir (result * GetWorkspaceConfigResult , rawSource string , maxDepth int , log log.Logger ) (* GetWorkspaceConfigResult , error ) {
53
+ func FindFilesInLocalDir (rawSource string , maxDepth int , log log.Logger ) (* GetWorkspaceConfigResult , error ) {
54
54
log .Debug ("Local directory detected" )
55
+ result := & GetWorkspaceConfigResult {ConfigPaths : []string {}}
55
56
result .IsLocal = true
56
57
initialDepth := strings .Count (rawSource , string (filepath .Separator ))
57
58
err := filepath .WalkDir (rawSource , func (path string , info fs.DirEntry , err error ) error {
@@ -81,8 +82,11 @@ func FindFilesInLocalDir(result *GetWorkspaceConfigResult, rawSource string, max
81
82
return result , nil
82
83
}
83
84
84
- func FindFilesInGitRepo (ctx context.Context , result * GetWorkspaceConfigResult , gitRepository , gitPRReference , gitBranch , gitCommit , gitSubDir , tmpDirPath string , maxDepth int , log log.Logger ) (* GetWorkspaceConfigResult , error ) {
85
- result .IsGitRepository = true
85
+ func FindFilesInGitRepo (ctx context.Context , gitRepository , gitPRReference , gitBranch , gitCommit , gitSubDir , tmpDirPath string , maxDepth int , log log.Logger ) (* GetWorkspaceConfigResult , error ) {
86
+ result := & GetWorkspaceConfigResult {
87
+ ConfigPaths : []string {},
88
+ IsGitRepository : true ,
89
+ }
86
90
87
91
gitInfo := git .NewGitInfo (gitRepository , gitBranch , gitCommit , gitPRReference , gitSubDir )
88
92
log .Debugf ("Cloning git repository into %s" , tmpDirPath )
0 commit comments