Fix issue where the git downloader re-downloads the source after updating it
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
This commit is contained in:
parent
c98741b8f2
commit
4218912123
|
@ -209,9 +209,10 @@ func Download(ctx context.Context, opts Options) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ok && !updated {
|
if ok && !updated {
|
||||||
log.Info("Source found in cache, linked to destination").Str("source", opts.Name).Stringer("type", t).Send()
|
log.Info("Source found in cache and linked to destination").Str("source", opts.Name).Stringer("type", t).Send()
|
||||||
return nil
|
return nil
|
||||||
} else if ok {
|
} else if ok {
|
||||||
|
log.Info("Source updated and linked to destination").Str("source", opts.Name).Stringer("type", t).Send()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -177,6 +177,9 @@ func (GitDownloader) Update(opts Options) (bool, error) {
|
||||||
po.RecurseSubmodules = git.DefaultSubmoduleRecursionDepth
|
po.RecurseSubmodules = git.DefaultSubmoduleRecursionDepth
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m, err := getManifest(opts.Destination)
|
||||||
|
manifestOK := err == nil
|
||||||
|
|
||||||
err = w.Pull(po)
|
err = w.Pull(po)
|
||||||
if errors.Is(err, git.NoErrAlreadyUpToDate) {
|
if errors.Is(err, git.NoErrAlreadyUpToDate) {
|
||||||
return false, nil
|
return false, nil
|
||||||
|
@ -184,5 +187,12 @@ func (GitDownloader) Update(opts Options) (bool, error) {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if manifestOK {
|
||||||
|
err = writeManifest(opts.Destination, m)
|
||||||
|
if err != nil {
|
||||||
|
return true, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue