File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -443,18 +443,26 @@ void prepare_alt_odb(void)
443443 read_info_alternates (get_object_directory (), 0 );
444444}
445445
446+ /* Returns 1 if we have successfully freshened the file, 0 otherwise. */
446447static int freshen_file (const char * fn )
447448{
448449 struct utimbuf t ;
449450 t .actime = t .modtime = time (NULL );
450451 return !utime (fn , & t );
451452}
452453
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+ */
453461static int check_and_freshen_file (const char * fn , int freshen )
454462{
455463 if (access (fn , F_OK ))
456464 return 0 ;
457- if (freshen && freshen_file (fn ))
465+ if (freshen && ! freshen_file (fn ))
458466 return 0 ;
459467 return 1 ;
460468}
You can’t perform that action at this time.
0 commit comments