+--- old/flist.c
++++ new/flist.c
+@@ -57,6 +57,7 @@ extern int copy_unsafe_links;
+ extern int protocol_version;
+ extern int sanitize_paths;
+ extern struct stats stats;
++extern char *link_by_hash_dir;
+ extern struct file_list *the_file_list;
+ extern alloc_pool_t hlink_pool;
+
+@@ -624,7 +625,7 @@ static struct file_struct *recv_file_ent
+ }
+ #endif
+
+- if (always_checksum && S_ISREG(mode))
++ if ((always_checksum || link_by_hash_dir) && S_ISREG(mode))
+ extra_len += SUM_EXTRA_CNT * EXTRA_LEN;
+
+ if (file_length > 0xFFFFFFFFu && S_ISREG(mode))