Re: [PATCHv4] sha1_file: fix iterating loose alternate objects
From: Jeff King <hidden>
Date: 2016-06-15 23:03:43
On Mon, Feb 02, 2015 at 10:48:12AM -0800, Jonathon Mah wrote:
The string in 'base' contains a path suffix to a specific object; when its value is used, the suffix must either be filled (as in stat_sha1_file, open_sha1_file, check_and_freshen_nonlocal) or cleared (as in prepare_packed_git) to avoid junk at the end. loose_from_alt_odb (introduced in 660c889e46d185dc98ba78963528826728b0a55d) did neither and treated 'base' as a complete path to the "base" object directory, instead of a pointer to the "base" of the full path string. The trailing path after 'base' is still initialized to NUL, hiding the bug in some common cases. Additionally the descendent for_each_file_in_obj_subdir function swallows ENOENT, so an error only shows if the alternate's path was last filled with a valid object (where statting /path/to/existing/00/0bjectfile/00 fails). Signed-off-by: Jonathon Mah <redacted> --- Squashed test and fix.
Thanks, this version looks good to me. -Peff