git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/3] compat/posix: drop legacy <utime.h> header and shims

From
AGAlexey Samsonov via GitGitGadget <gitgitgadget@gmail.com>
Date
Aug 21, 2026, 14:23 UTC
Message-ID
<9c737bd600bac6b6645a10f6b36951985a99262d.1787322203.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.2209.git.1787322203.gitgitgadget@gmail.com>
From: Alexey Samsonov <vonosmas@gmail.com>

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>
---
 compat/mingw-posix.h               |  2 --
 compat/mingw.c                     | 16 --------------
 compat/posix.h                     |  1 -
 compat/vcbuild/include/sys/utime.h | 34 ------------------------------
 compat/vcbuild/include/utime.h     |  1 -
 t/helper/test-chmtime.c            |  1 -
 t/t4051/includes.c                 |  1 -
 7 files changed, 56 deletions(-)
 delete mode 100644 compat/vcbuild/include/sys/utime.h
 delete mode 100644 compat/vcbuild/include/utime.h
diff --git a/compat/mingw-posix.h b/compat/mingw-posix.h
index aab91d76db..286ca24002 100644
--- a/compat/mingw-posix.h
+++ b/compat/mingw-posix.h
@@ -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,
diff --git a/compat/mingw.c b/compat/mingw.c
index d09a976191..e2ec44fdd2 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -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)
diff --git a/compat/posix.h b/compat/posix.h
index 3cac1751aa..435ed90f56 100644
--- a/compat/posix.h
+++ b/compat/posix.h
@@ -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>
diff --git a/compat/vcbuild/include/sys/utime.h b/compat/vcbuild/include/sys/utime.h
deleted file mode 100644
index 582589c70a..0000000000
--- a/compat/vcbuild/include/sys/utime.h
+++ /dev/null
@@ -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
diff --git a/compat/vcbuild/include/utime.h b/compat/vcbuild/include/utime.h
deleted file mode 100644
index 8285f38fde..0000000000
--- a/compat/vcbuild/include/utime.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <sys/utime.h>
diff --git a/t/helper/test-chmtime.c b/t/helper/test-chmtime.c
index a9e6eb78b8..295f55cf47 100644
--- a/t/helper/test-chmtime.c
+++ b/t/helper/test-chmtime.c
@@ -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>...";
diff --git a/t/t4051/includes.c b/t/t4051/includes.c
index efc68f8bf6..4861f6657b 100644
--- a/t/t4051/includes.c
+++ b/t/t4051/includes.c
@@ -15,6 +15,5 @@
 #include <signal.h>
 #include <assert.h>
 #include <regex.h>
-#include <utime.h>
 #include <syslog.h>
 #include <End.h>
-- 
gitgitgadget
Previous: Alexey Samsonov via GitGitGadgetNext: Junio C Hamano
Message 4 of 19 in “treewide: migrate from legacy utime.h to utimensat”
  1. 0/3 treewide: migrate from legacy utime.h to utimensatAlexey Samsonov via GitGitGadget, Aug 21, 2026
  2. 1/3 compat/posix: introduce utimensat(2) wrapperAlexey Samsonov via GitGitGadget, Aug 21, 2026
  3. 2/3 treewide: use utimensat(2) instead of legacy utime(3p)Alexey Samsonov via GitGitGadget, Aug 21, 2026
  4. 3/3 compat/posix: drop legacy <utime.h> header and shimsAlexey Samsonov via GitGitGadget, Aug 21, 2026
  5. Junio C HamanoAug 21, 2026
  6. brian m. carlsonAug 22, 2026
  7. Junio C HamanoAug 22, 2026
  8. brian m. carlsonAug 22, 2026
  9. Junio C HamanoAug 23, 2026
  10. Weijie YuanAug 23, 2026
  11. Junio C HamanoAug 23, 2026
  12. Weijie YuanAug 23, 2026
  13. Junio C HamanoAug 24, 2026
  14. Weijie YuanAug 24, 2026
  15. Weijie YuanAug 24, 2026
  16. Junio C HamanoAug 24, 2026
  17. Junio C HamanoAug 24, 2026
  18. Weijie YuanAug 24, 2026
  19. Oswald BuddenhagenAug 24, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.