Duplicate file receive logic in delta fallback path in file.c #54
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
In
src/shared/file.c, thereceive_delta_file()function (lines 263-303) contains duplicated code for receiving a file when delta transfer falls back (STATUS_NEXTafterSTATUS_DELTA_SIGNATURE). The decompression and metadata handling logic is essentially identical tofile_receive()(lines 470-503).Specifically, lines 267-303 duplicate the pattern of:
Filefrom the pathuse_metadatais setLocation
src/shared/file.c:263-303andsrc/shared/file.c:470-503Suggested Fix
Refactor
receive_delta_file()to callfile_receive()instead of duplicating the logic. The delta fallback path can usefile_receive()and then return the received file directly.Severity
Medium
Category
Quality