@matheusbsbs / matheus-bagliano / commits / 312cd76130
Fork 0

freshen_file(): use NULL `times' for implicit current-time

Update freshen_file() to use a NULL `times', semantically equivalent to the currently setup, with an explicit `actime' and `modtime' set to the "current time", but with the advantage that it works with other files not owned by the current user. Fixes an issue on shared repos with a split index, where eventually a user's operation creates a shared index, and another user will later do an operation that will try to update its freshness, but will instead raise a warning: $ git status warning: could not freshen shared index '.git/sharedindex.bd736fa10e0519593fefdb2aec253534470865b2' Signed-off-by: Luciano Miguel Ferreira Rocha <luciano.rocha@booking.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

luciano.rocha@booking.com committed Apr 14, 2020 at 16:27 UTC 312cd7613013adbf9842e17a61b15d0e5950fb8c
1 file changed +1 -3
sha1-file.c
+1 -3
@@ -868,9 +868,7 @@ void prepare_alt_odb(struct repository *r)
868 /* Returns 1 if we have successfully freshened the file, 0 otherwise. */
869 static int freshen_file(const char *fn)
870 {
871 - struct utimbuf t;
872 - t.actime = t.modtime = time(NULL);
873 - return !utime(fn, &t);
871 + return !utime(fn, NULL);
872 }
873
874 /*