Fix generate task override behaviour (#3661)

This commit is contained in:
DingDongSoLong4
2023-05-03 05:42:25 +02:00
committed by GitHub
parent 1717474a81
commit 67a2161c62
9 changed files with 96 additions and 51 deletions

View File

@@ -24,7 +24,7 @@ func (t *GeneratePhashTask) GetDescription() string {
}
func (t *GeneratePhashTask) Start(ctx context.Context) {
if !t.shouldGenerate() {
if !t.required() {
return
}
@@ -49,6 +49,10 @@ func (t *GeneratePhashTask) Start(ctx context.Context) {
}
}
func (t *GeneratePhashTask) shouldGenerate() bool {
return t.Overwrite || t.File.Fingerprints.Get(file.FingerprintTypePhash) == nil
func (t *GeneratePhashTask) required() bool {
if t.Overwrite {
return true
}
return t.File.Fingerprints.Get(file.FingerprintTypePhash) == nil
}