diff --git a/src/libstore/profiles.cc b/src/libstore/profiles.cc index 44c3c6e0d..b43ec66f6 100644 --- a/src/libstore/profiles.cc +++ b/src/libstore/profiles.cc @@ -159,7 +159,6 @@ void deleteGenerations(const Path & profile, const std::set & gens void deleteGenerationsGreaterThan(const Path & profile, int max, bool dryRun) { - int max_keep = 0; PathLocks lock; lockProfile(lock, profile); @@ -172,7 +171,8 @@ void deleteGenerationsGreaterThan(const Path & profile, int max, bool dryRun) max--; continue; } - deleteGeneration2(profile, i->number, dryRun); + if (i->number != curGen) + deleteGeneration2(profile, i->number, dryRun); } }