mirror of
https://github.com/git-for-windows/git.git
synced 2026-04-02 19:26:05 -05:00
mingw: use strftime() directly in UCRT builds (#6130)
Currently, Git for Windows is built off of the MINGW64 tool chain. But this will have to change because [the MSYS2 project deprecated this tool chain in favor of UCRT64](https://www.msys2.org/news/#2026-03-15-deprecating-the-mingw64-environment). Of course, that's only possible because they dropped support for Windows 8.1, which Git for Windows will probably have to do relatively soon. The best time to do that is probably [the Git 3.0 inflection point](https://github.com/git-for-windows/git/discussions/6018) when we already promised to drop support for older Windows versions. To prepare for such a huge change, I investigated what needs to be changed in Git for Windows' source code. And the good news is there's actually not very much. This here patch seems to be the only change that's necessary, and not even _strictly_ necessary: the `mingw_strftime()` wrapper would still do the right thing. It would just uselessly load the same function that's already loaded, dynamically, again. - The `strerror()` override [is guarded by an `#ifndef _UCRT`](https://github.com/git-for-windows/git/blob/v2.53.0.windows.2/compat/mingw-posix.h#L294-L296), - `PRIuMAX` resolves to standard `"llu"` [via `<inttypes.h>`](https://github.com/git-for-windows/git/blob/v2.53.0.windows.2/compat/mingw-posix.h#L449-L454) (note that `__MINGW64_VERSION_MAJOR` is defined both in MINGW64 and UCRT64, by virtue of using the `mingw-w64-headers`), - [`__USE_MINGW_ANSI_STDIO=0`](https://github.com/git-for-windows/git/blob/v2.53.0.windows.2/config.mak.uname#L751C19-L751C33) is irrelevant because [`_UCRT` short-circuits it](08933e673c/mingw64/include/inttypes.h (L33)), and - `SNPRINTF_RETURNS_BOGUS` hasn't been set for Git for Windows' builds sinceec47a33fd2, i.e. for a _really_ long time.
This commit is contained in:
committed by
Git for Windows Build Agent
commit
cd0c27a38a
@@ -9,6 +9,7 @@ SYNOPSIS
|
||||
--------
|
||||
[verse]
|
||||
'git svn' <command> [<options>] [<arguments>]
|
||||
(UNSUPPORTED!)
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
@@ -1509,6 +1509,9 @@ revert_attrs:
|
||||
size_t mingw_strftime(char *s, size_t max,
|
||||
const char *format, const struct tm *tm)
|
||||
{
|
||||
#ifdef _UCRT
|
||||
size_t ret = strftime(s, max, format, tm);
|
||||
#else
|
||||
/* a pointer to the original strftime in case we can't find the UCRT version */
|
||||
static size_t (*fallback)(char *, size_t, const char *, const struct tm *) = strftime;
|
||||
size_t ret;
|
||||
@@ -1519,6 +1522,7 @@ size_t mingw_strftime(char *s, size_t max,
|
||||
ret = strftime(s, max, format, tm);
|
||||
else
|
||||
ret = fallback(s, max, format, tm);
|
||||
#endif
|
||||
|
||||
if (!ret && errno == EINVAL)
|
||||
die("invalid strftime format: '%s'", format);
|
||||
|
||||
13
git-svn.perl
13
git-svn.perl
@@ -305,6 +305,19 @@ sub term_init {
|
||||
: new Term::ReadLine 'git-svn';
|
||||
}
|
||||
|
||||
sub deprecated_warning {
|
||||
my @lines = @_;
|
||||
if (-t STDERR) {
|
||||
@lines = map { "\e[33m$_\e[0m" } @lines;
|
||||
}
|
||||
warn join("\n", @lines), "\n";
|
||||
}
|
||||
|
||||
deprecated_warning(
|
||||
"WARNING: \`git svn\` is no longer supported by the Git for Windows project.",
|
||||
"See https://github.com/git-for-windows/git/issues/5405 for details."
|
||||
);
|
||||
|
||||
my $cmd;
|
||||
for (my $i = 0; $i < @ARGV; $i++) {
|
||||
if (defined $cmd{$ARGV[$i]}) {
|
||||
|
||||
1
http.c
1
http.c
@@ -162,6 +162,7 @@ static long http_retry_after = 0;
|
||||
static long http_max_retries = 0;
|
||||
static long http_max_retry_time = 300;
|
||||
|
||||
|
||||
/*
|
||||
* With the backend being set to `schannel`, setting sslCAinfo would override
|
||||
* the Certificate Store in cURL v7.60.0 and later, which is not what we want
|
||||
|
||||
@@ -110,7 +110,8 @@ test_expect_success 'test disallow multi-globs' '
|
||||
svn_cmd commit -m "try to try"
|
||||
) &&
|
||||
test_must_fail git svn fetch three 2> stderr.three &&
|
||||
test_cmp expect.three stderr.three
|
||||
sed "/^WARNING.*no.* supported/{N;d}" <stderr.three >stderr.three.clean &&
|
||||
test_cmp expect.three stderr.three.clean
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -161,7 +161,8 @@ test_expect_success 'test disallow multiple globs' '
|
||||
svn_cmd commit -m "try to try"
|
||||
) &&
|
||||
test_must_fail git svn fetch three 2> stderr.three &&
|
||||
test_cmp expect.three stderr.three
|
||||
sed "/^WARNING.*no.* supported/{N;d}" <stderr.three >stderr.three.clean &&
|
||||
test_cmp expect.three stderr.three.clean
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -155,7 +155,8 @@ test_expect_success 'test disallow prefixed multi-globs' '
|
||||
svn_cmd commit -m "try to try"
|
||||
) &&
|
||||
test_must_fail git svn fetch four 2>stderr.four &&
|
||||
test_cmp expect.four stderr.four &&
|
||||
sed "/^WARNING.*no.* supported/{N;d}" <stderr.four >stderr.four.clean &&
|
||||
test_cmp expect.four stderr.four.clean &&
|
||||
git config --unset svn-remote.four.branches &&
|
||||
git config --unset svn-remote.four.tags
|
||||
'
|
||||
@@ -223,7 +224,8 @@ test_expect_success 'test disallow multiple asterisks in one word' '
|
||||
svn_cmd commit -m "try to try"
|
||||
) &&
|
||||
test_must_fail git svn fetch six 2>stderr.six &&
|
||||
test_cmp expect.six stderr.six
|
||||
sed "/^WARNING.*no.* supported/{N;d}" <stderr.six >stderr.six.clean &&
|
||||
test_cmp expect.six stderr.six.clean
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
Reference in New Issue
Block a user