diff --git a/internal/cli/freshen.go b/internal/cli/freshen.go index c2a5aa9..40cc2a4 100644 --- a/internal/cli/freshen.go +++ b/internal/cli/freshen.go @@ -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) }