Skip to content

Commit

Permalink
ref: Terminate import if errors are encountered]
Browse files Browse the repository at this point in the history
  • Loading branch information
Erick Kramer committed May 23, 2024
1 parent 8abccf5 commit 3af6367
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ import cycle.`,

// Import repository files in the given file
validFile := singleCloneSweep(cloningPath, filePath, numWorkers, skipExisting)
if !validFile {
os.Exit(1)
}
if !recursiveFlag {
if !validFile {
os.Exit(1)
}
os.Exit(0)
}
nestedImportClones(cloningPath, filePath, depthRecursive, numWorkers, skipExisting)
Expand Down Expand Up @@ -104,6 +104,7 @@ func singleCloneSweep(root string, filePath string, numWorkers int, skipExisting
for result := range results {
if !result {
validFile = false
fmt.Printf("Failed while cloning %s\n", filePath)
break
}
}
Expand Down Expand Up @@ -137,6 +138,7 @@ func nestedImportClones(cloningPath string, initialFilePath string, depthRecursi
newReposFileFound = true
if !validFiles {
utils.PrintErrorMsg("Encountered errors while importing file")
os.Exit(1)
}
}
}
Expand All @@ -146,7 +148,4 @@ func nestedImportClones(cloningPath string, initialFilePath string, depthRecursi
cloneSweepCounter++
}

if !validFiles {
os.Exit(1)
}
}

0 comments on commit 3af6367

Please sign in to comment.