File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -443,18 +443,26 @@ void prepare_alt_odb(void)
443
443
read_info_alternates (get_object_directory (), 0 );
444
444
}
445
445
446
+ /* Returns 1 if we have successfully freshened the file, 0 otherwise. */
446
447
static int freshen_file (const char * fn )
447
448
{
448
449
struct utimbuf t ;
449
450
t .actime = t .modtime = time (NULL );
450
451
return !utime (fn , & t );
451
452
}
452
453
454
+ /*
455
+ * All of the check_and_freshen functions return 1 if the file exists and was
456
+ * freshened (if freshening was requested), 0 otherwise. If they return
457
+ * 0, you should not assume that it is safe to skip a write of the object (it
458
+ * either does not exist on disk, or has a stale mtime and may be subject to
459
+ * pruning).
460
+ */
453
461
static int check_and_freshen_file (const char * fn , int freshen )
454
462
{
455
463
if (access (fn , F_OK ))
456
464
return 0 ;
457
- if (freshen && freshen_file (fn ))
465
+ if (freshen && ! freshen_file (fn ))
458
466
return 0 ;
459
467
return 1 ;
460
468
}
You can’t perform that action at this time.
0 commit comments