Skip to content

Commit e5f698d

Browse files
derrickstoleedscho
authored andcommitted
gvfs-helper: avoid collision check for packfiles
Similar to a recent change to avoid the collision check for loose objects, do the same for prefetch packfiles. This should be more rare, but the same prefetch packfile could be downloaded from the same cache server so this isn't out of the range of possibility. Signed-off-by: Derrick Stolee <stolee@gmail.com>
1 parent 400e944 commit e5f698d

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

gvfs-helper.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,12 +1940,21 @@ static void my_finalize_packfile(struct gh__request_params *params,
19401940
* files, do we create the matching .keep (when requested).
19411941
*
19421942
* If we get an error and the target files already exist, we
1943-
* silently eat the error. Note that finalize_object_file()
1943+
* silently eat the error. Note that finalize_object_file_flags()
19441944
* has already munged errno (and it has various creation
19451945
* strategies), so we don't bother looking at it.
1946+
*
1947+
* We use FOF_SKIP_COLLISION_CHECK in case the same packfile was
1948+
* attempted for install earlier but got corrupted or failed to
1949+
* flush due to a disk issue. This prevents a narrow failure case
1950+
* but is better than failing for silly reasons.
19461951
*/
1947-
if (finalize_object_file(the_repository, temp_path_pack->buf, final_path_pack->buf) ||
1948-
finalize_object_file(the_repository, temp_path_idx->buf, final_path_idx->buf)) {
1952+
if (finalize_object_file_flags(the_repository,
1953+
temp_path_pack->buf, final_path_pack->buf,
1954+
FOF_SKIP_COLLISION_CHECK) ||
1955+
finalize_object_file_flags(the_repository,
1956+
temp_path_idx->buf, final_path_idx->buf,
1957+
FOF_SKIP_COLLISION_CHECK)) {
19491958
unlink(temp_path_pack->buf);
19501959
unlink(temp_path_idx->buf);
19511960

0 commit comments

Comments
 (0)