mirror of
https://github.com/gilbertchen/duplicacy
synced 2025-12-14 23:33:18 +00:00
Merge pull request #183 from jt70471/prune-patch-1
fix prune bug when last snapshot is removed for issue #182
This commit is contained in:
@@ -2065,7 +2065,7 @@ func (manager *SnapshotManager) PruneSnapshots(selfID string, snapshotID string,
|
|||||||
snapshot.ID, snapshot.Revision)
|
snapshot.ID, snapshot.Revision)
|
||||||
}
|
}
|
||||||
manager.snapshotCache.DeleteFile(0, snapshotPath)
|
manager.snapshotCache.DeleteFile(0, snapshotPath)
|
||||||
fmt.Fprintf(logFile, "Deleted snapshot %s at revision %d\n", snapshot.ID, snapshot.Revision)
|
fmt.Fprintf(logFile, "Deleted cached snapshot %s at revision %d\n", snapshot.ID, snapshot.Revision)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2074,12 +2074,16 @@ func (manager *SnapshotManager) PruneSnapshots(selfID string, snapshotID string,
|
|||||||
"No fossil collection has been created since deleted snapshots did not reference any unique chunks")
|
"No fossil collection has been created since deleted snapshots did not reference any unique chunks")
|
||||||
}
|
}
|
||||||
|
|
||||||
var latestSnapshot *Snapshot
|
var latestSnapshot *Snapshot = nil
|
||||||
if len(allSnapshots[selfID]) > 0 {
|
if len(allSnapshots[selfID]) > 0 {
|
||||||
latestSnapshot = allSnapshots[selfID][len(allSnapshots[selfID]) - 1]
|
latestSnapshot = allSnapshots[selfID][len(allSnapshots[selfID]) - 1]
|
||||||
}
|
}
|
||||||
|
|
||||||
manager.CleanSnapshotCache(latestSnapshot, allSnapshots)
|
if latestSnapshot != nil && !latestSnapshot.Flag {
|
||||||
|
manager.CleanSnapshotCache(latestSnapshot, allSnapshots)
|
||||||
|
} else {
|
||||||
|
manager.CleanSnapshotCache(nil, allSnapshots)
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user