Skip manifest write when nothing changed in freshen
This commit is contained in:
parent
b3fe38092b
commit
a07209fef5
@ -284,7 +284,17 @@ func (mfa *CLIApp) freshenManifestOperation(ctx *cli.Context) error {
|
||||
log.ProgressDone()
|
||||
}
|
||||
|
||||
// Write updated manifest
|
||||
// Print summary
|
||||
log.Infof("freshen complete: %d unchanged, %d changed, %d added, %d removed",
|
||||
unchanged, changed, added, removed)
|
||||
|
||||
// Skip writing if nothing changed
|
||||
if changed == 0 && added == 0 && removed == 0 {
|
||||
log.Infof("manifest unchanged, skipping write")
|
||||
return nil
|
||||
}
|
||||
|
||||
// Write updated manifest atomically (write to temp, then rename)
|
||||
tmpPath := manifestPath + ".tmp"
|
||||
outFile, err := mfa.Fs.Create(tmpPath)
|
||||
if err != nil {
|
||||
@ -304,16 +314,11 @@ func (mfa *CLIApp) freshenManifestOperation(ctx *cli.Context) error {
|
||||
return fmt.Errorf("failed to rename manifest: %w", err)
|
||||
}
|
||||
|
||||
// Print summary
|
||||
totalDuration := time.Since(mfa.startupTime)
|
||||
var hashRate float64
|
||||
if hashedBytes > 0 {
|
||||
hashDuration := time.Since(startHash)
|
||||
hashRate = float64(hashedBytes) / hashDuration.Seconds() / 1e6
|
||||
}
|
||||
log.Infof("freshen complete: %d unchanged, %d changed, %d added, %d removed",
|
||||
unchanged, changed, added, removed)
|
||||
if filesToHash > 0 {
|
||||
log.Infof("hashed %.1f MB in %.1fs (%.1f MB/s)",
|
||||
float64(hashedBytes)/1e6, totalDuration.Seconds(), hashRate)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user