mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-11 13:30:47 -04:00
Move sorting & add a comment
This commit is contained in:
parent
df5de1f486
commit
bd2e66fdea
@ -167,10 +167,6 @@ class file_scanner {
|
|||||||
auto& files = p.second;
|
auto& files = p.second;
|
||||||
|
|
||||||
if constexpr (Unique) {
|
if constexpr (Unique) {
|
||||||
std::sort(files.begin(), files.end(), [](file const* a, file const* b) {
|
|
||||||
return a->path() < b->path();
|
|
||||||
});
|
|
||||||
|
|
||||||
// this is true regardless of how the files are ordered
|
// this is true regardless of how the files are ordered
|
||||||
if (files.size() > files.front()->refcount()) {
|
if (files.size() > files.front()->refcount()) {
|
||||||
continue;
|
continue;
|
||||||
@ -185,6 +181,11 @@ class file_scanner {
|
|||||||
DWARFS_CHECK(files.size() > 1, "unexpected non-duplicate file");
|
DWARFS_CHECK(files.size() > 1, "unexpected non-duplicate file");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this isn't strictly necessary, but helps metadata compression
|
||||||
|
std::sort(files.begin(), files.end(), [](file const* a, file const* b) {
|
||||||
|
return a->path() < b->path();
|
||||||
|
});
|
||||||
|
|
||||||
for (auto fp : files) {
|
for (auto fp : files) {
|
||||||
// need to check because hardlinks share the same number
|
// need to check because hardlinks share the same number
|
||||||
if (!fp->inode_num()) {
|
if (!fp->inode_num()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user