Skip to content

Commit 77f32ed

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 ea2b542 commit 77f32ed

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
@@ -852,7 +852,7 @@ static void rm_shred_group_update_status(RmShredGroup *group) {
852852
} else if(group->n_clusters > 1) {
853853
// we have potential match candidates; start hashing
854854
group->status = RM_SHRED_GROUP_START_HASHING;
855-
} else if(group->n_inodes == 1 && group->n_unhashed_clusters > 0 &&
855+
} else if(group->num_files > 1 && group->n_unhashed_clusters > 0 &&
856856
group->session->cfg->merge_directories) {
857857
/* special case of hardlinked files that still need hashing to help identify
858858
* matching directories */

0 commit comments

Comments
 (0)