compat/posix: drop legacy <utime.h> header and shims

With all callers across the codebase now converted to utimensat(2), we no
longer need to include the legacy <utime.h> header in `compat/posix.h`.

Remove `#include <utime.h>` from `compat/posix.h` and test fixtures,
remove `mingw_utime()` from `compat/mingw.c`, and delete the legacy
header shims in `compat/vcbuild/include/`.

Signed-off-by: Alexey Samsonov <vonosmas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
jch
Alexey Samsonov 2026-08-21 14:23:23 +00:00 committed by Junio C Hamano
parent 2c8ab1aa3e
commit ae977d6bea
7 changed files with 0 additions and 56 deletions

View File

@ -384,8 +384,6 @@ int mingw_fstat(int fd, struct stat *buf);
#define lstat mingw_lstat


int mingw_utime(const char *file_name, const struct utimbuf *times);
#define utime mingw_utime
int mingw_utimensat(int fd, const char *path, const struct timespec times[2], int flag);
#define utimensat mingw_utimensat
size_t mingw_strftime(char *s, size_t max,

View File

@ -1480,22 +1480,6 @@ revert_attrs:
return rc;
}

int mingw_utime(const char *file_name, const struct utimbuf *times)
{
struct timespec ts[2];
struct timespec *tsp = NULL;

if (times) {
ts[0].tv_sec = times->actime;
ts[0].tv_nsec = 0;
ts[1].tv_sec = times->modtime;
ts[1].tv_nsec = 0;
tsp = ts;
}

return mingw_utimensat(AT_FDCWD, file_name, tsp, 0);
}

#undef strftime
size_t mingw_strftime(char *s, size_t max,
const char *format, const struct tm *tm)

View File

@ -123,7 +123,6 @@
#include <signal.h>
#include <assert.h>
#include <regex.h>
#include <utime.h>
#include <syslog.h>
#if !defined(NO_POLL_H)
#include <poll.h>

View File

@ -1,34 +0,0 @@
#ifndef _UTIME_H_
#define _UTIME_H_
/*
* UTIME.H
* This file has no copyright assigned and is placed in the Public Domain.
* This file is a part of the mingw-runtime package.
*
* The mingw-runtime package and its code is distributed in the hope that it
* will be useful but WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESSED OR
* IMPLIED ARE HEREBY DISCLAIMED. This includes but is not limited to
* warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* You are free to use this package and its code without limitation.
*/

/*
* Structure used by _utime function.
*/
struct _utimbuf
{
time_t actime; /* Access time */
time_t modtime; /* Modification time */
};

#ifndef _NO_OLDNAMES
/* NOTE: Must be the same as _utimbuf above. */
struct utimbuf
{
time_t actime;
time_t modtime;
};
#endif /* Not _NO_OLDNAMES */

#endif

View File

@ -1 +0,0 @@
#include <sys/utime.h>

View File

@ -38,7 +38,6 @@
*/
#include "test-tool.h"
#include "git-compat-util.h"
#include <utime.h>

static const char usage_str[] =
"(-v|--verbose|-g|--get) (+|=|=+|=-|-)<seconds> <file>...";

View File

@ -15,6 +15,5 @@
#include <signal.h>
#include <assert.h>
#include <regex.h>
#include <utime.h>
#include <syslog.h>
#include <End.h>