All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexey Samsonov via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Alexey Samsonov <vonosmas@gmail.com>
Subject: [PATCH 0/3] treewide: migrate from legacy utime.h to utimensat
Date: Fri, 21 Aug 2026 14:23:20 +0000	[thread overview]
Message-ID: <pull.2209.git.1787322203.gitgitgadget@gmail.com> (raw)

utime() function for setting access/modification time for files (and a
corresponding <utime.h> header) have been officially removed from POSIX
starting from POSIX.1-2024. While existing system library implementations
still provide this function for compatibility reasons, its implementation
may be removed in the future, or otherwise degrade over time. Some newer
libc implementations (e.g. LLVM-libc, currently under development) don't
provide utime() function at all.

This PR switches the git codebase to recommended alternative: utimensat()
POSIX function (which supports nanosecond-level precision) from <fcntl.h>,
and, as a possible fallback for older systems compatibility, utimes()
function from <sys/stat.h>. It also provides the corresponding MinGW
wrapper.

The alternative is to unconditionally use utimes() where possible, but given
that utimensat is available in glibc starting from 2007, and on BSD systems
since 2012 or so, it makes sense to use the newer variant by default.

No behavior changes is intended or expected (except for Git explicitly
passing nanosecond-precision timestamps to kernel, where previously only
second-level precision was used).

This change is generated by Gemini Flash from Antigravity, but all the code
has been manually verified by me, and, where applicable, adjusted to match
the existing behavior as closely as possible.

Signed-off-by: Alexey Samsonov vonosmas@gmail.com

Alexey Samsonov (3):
  compat/posix: introduce utimensat(2) wrapper
  treewide: use utimensat(2) instead of legacy utime(3p)
  compat/posix: drop legacy <utime.h> header and shims

 Makefile                            |  6 +++++
 builtin/pack-objects.c              | 12 +++++----
 commit-graph.c                      | 17 +++++--------
 compat/mingw-posix.h                |  4 +--
 compat/mingw.c                      | 36 ++++++++++++++++++++------
 compat/posix.h                      | 22 +++++++++++++++-
 compat/utimensat.c                  | 39 +++++++++++++++++++++++++++++
 compat/vcbuild/include/sys/utime.h  | 34 -------------------------
 compat/vcbuild/include/utime.h      |  1 -
 configure.ac                        |  6 +++++
 contrib/buildsystems/CMakeLists.txt |  8 ++++--
 copy.c                              | 10 +++++---
 meson.build                         |  2 ++
 object-file.c                       | 12 +++++----
 odb/source-loose.c                  | 10 ++++----
 odb/source-packed.c                 | 12 +++++----
 rerere.c                            |  4 +--
 t/helper/test-chmtime.c             | 20 +++++++++------
 t/t4051/includes.c                  |  1 -
 19 files changed, 163 insertions(+), 93 deletions(-)
 create mode 100644 compat/utimensat.c
 delete mode 100644 compat/vcbuild/include/sys/utime.h
 delete mode 100644 compat/vcbuild/include/utime.h


base-commit: dea0ea3582e6980ddbc1173cc8e3e9f9db91cde0
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2209%2Fvonosmas%2Fdrop-utime-h-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2209/vonosmas/drop-utime-h-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2209
-- 
gitgitgadget

             reply	other threads:[~2026-08-21 14:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 14:23 Alexey Samsonov via GitGitGadget [this message]
2026-08-21 14:23 ` [PATCH 1/3] compat/posix: introduce utimensat(2) wrapper Alexey Samsonov via GitGitGadget
2026-08-21 14:23 ` [PATCH 2/3] treewide: use utimensat(2) instead of legacy utime(3p) Alexey Samsonov via GitGitGadget
2026-08-21 14:23 ` [PATCH 3/3] compat/posix: drop legacy <utime.h> header and shims Alexey Samsonov via GitGitGadget
2026-08-21 17:33 ` [PATCH 0/3] treewide: migrate from legacy utime.h to utimensat Junio C Hamano
2026-08-22 16:03 ` brian m. carlson
2026-08-22 17:59   ` Junio C Hamano
2026-08-22 21:15     ` brian m. carlson
2026-08-23 15:23       ` Junio C Hamano
2026-08-23 13:26     ` Weijie Yuan
2026-08-23 15:26       ` Junio C Hamano
2026-08-23 15:45         ` Weijie Yuan
2026-08-24  1:49           ` Junio C Hamano
2026-08-24 12:19             ` Weijie Yuan
2026-08-24 15:33             ` Weijie Yuan
2026-08-24 16:06               ` Junio C Hamano
2026-08-24 16:23                 ` Junio C Hamano
2026-08-24 16:33                 ` Weijie Yuan
2026-08-24 20:25                 ` Oswald Buddenhagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.2209.git.1787322203.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=vonosmas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.