Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions backend/plugins/gitextractor/parser/clone_gitcli.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ import (
)

var _ RepoCloner = (*GitcliCloner)(nil)
var ErrShallowInfoProcessing = errors.BadInput.New("No data found for the selected time range. Please revise the 'Time Range' on your Project/Blueprint/Configuration page or in the API parameter.")
var ErrNoDataOnIncrementalMode = errors.NotModified.New("No data found since the previous run.")
var ErrNoData = errors.NotModified.New("No data to be collected")

type GitcliCloner struct {
logger log.Logger
Expand Down Expand Up @@ -84,10 +83,6 @@ func (g *GitcliCloner) CloneRepo(ctx plugin.SubTaskContext, localDir string) err
}
err = g.execCloneCommand(cmd)
if err != nil {
// it is likely that nothing to collect on incrmental mode
if errors.Is(err, ErrShallowInfoProcessing) && g.stateManager != nil && g.stateManager.IsIncremental() {
return ErrNoDataOnIncrementalMode
}
return err
}
// deepen the commits by 1 more step to avoid https://github.com/apache/incubator-devlake/issues/7426
Expand Down Expand Up @@ -222,7 +217,7 @@ func (g *GitcliCloner) execCloneCommand(cmd *exec.Cmd) errors.Error {
g.logger.Error(err, "git exited with error\n%s", combinedOutput.String())
if strings.Contains(combinedOutput.String(), "stderr: fatal: error processing shallow info: 4") ||
strings.Contains(combinedOutput.String(), "stderr: fatal: the remote end hung up unexpectedly") {
return ErrShallowInfoProcessing
return ErrNoData
}
return errors.Default.New("git exit error")
}
Expand Down
5 changes: 1 addition & 4 deletions backend/plugins/gitextractor/tasks/repo_cloner.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,10 @@ func CloneGitRepo(subTaskCtx plugin.SubTaskContext) errors.Error {
repoCloner := parser.NewGitcliCloner(subTaskCtx)
err = repoCloner.CloneRepo(subTaskCtx, localDir)
if err != nil {
if errors.Is(err, parser.ErrNoDataOnIncrementalMode) {
if errors.Is(err, parser.ErrNoData) {
taskData.SkipAllSubtasks = true
return nil
}
if errors.Is(err, parser.ErrShallowInfoProcessing) {
return nil
}
return err
}

Expand Down