Skip to content

Commit b0d836b

Browse files
committed
shredder: only hash single-inode groups that are actually hardlinked
`group->n_inodes == 1` is also true for groups that simply consist of a single file. This condition will cause all single-file groups to be hashed if `--merge-directories` is also set. Additionally, the whole `group->n_inodes == 1` condition is redundant because not following on the branch means that `group->n_clusters == 1` and therefore `group->n_inodes == 1`. Thus, check that we are actually dealing with a group of hardlinks (and not just a single-file group that did not cause an early return because we are also doing `--hash-unmatched`). Fixes #614.
1 parent 5f0dbec commit b0d836b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/shredder.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ static void rm_shred_group_update_status(RmShredGroup *group) {
848848
} else if(group->n_clusters > 1) {
849849
// we have potential match candidates; start hashing
850850
group->status = RM_SHRED_GROUP_START_HASHING;
851-
} else if(group->n_inodes == 1 && group->n_unhashed_clusters > 0 &&
851+
} else if(group->num_files > 1 && group->n_unhashed_clusters > 0 &&
852852
group->session->cfg->merge_directories) {
853853
/* special case of hardlinked files that still need hashing to help identify
854854
* matching directories */

0 commit comments

Comments
 (0)