<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/date.c, branch jch</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=jch</id>
<link rel='self' href='https://git.shady.money/git/atom?h=jch'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2024-12-26T21:34:28Z</updated>
<entry>
<title>date.c: Fix type missmatch warings from msvc</title>
<updated>2024-12-26T21:34:28Z</updated>
<author>
<name>Sören Krecker</name>
<email>soekkle@freenet.de</email>
</author>
<published>2024-12-23T11:04:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d11d003ba5e98c036fb94204df6dcef28aafe2f8'/>
<id>urn:sha1:d11d003ba5e98c036fb94204df6dcef28aafe2f8</id>
<content type='text'>
Fix compiler warings from msvc in date.c for value truncation from 64
bit to 32 bit integers.

Also switch from int to size_t for all variables with result of strlen()
which cannot become negative.

Signed-off-by: Sören Krecker &lt;soekkle@freenet.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>global: mark code units that generate warnings with `-Wsign-compare`</title>
<updated>2024-12-06T11:20:02Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-12-06T10:27:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=41f43b8243f42b9df2e98be8460646d4c0100ad3'/>
<id>urn:sha1:41f43b8243f42b9df2e98be8460646d4c0100ad3</id>
<content type='text'>
Mark code units that generate warnings with `-Wsign-compare`. This
allows for a structured approach to get rid of all such warnings over
time in a way that can be easily measured.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>date: detect underflow/overflow when parsing dates with timezone offset</title>
<updated>2024-06-26T00:07:41Z</updated>
<author>
<name>Darcy Burke</name>
<email>acednes@gmail.com</email>
</author>
<published>2024-06-25T23:12:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9d69789770155cc6573ed07862de3b28f0597a25'/>
<id>urn:sha1:9d69789770155cc6573ed07862de3b28f0597a25</id>
<content type='text'>
Overriding the date of a commit to be close to "1970-01-01 00:00:00"
with a large enough positive timezone for the equivelant GMT time to be
before the epoch is considered valid by `parse_date_basic`. Similar
behaviour occurs when using a date close to "2099-12-31 23:59:59" (the
maximum date allowed by `tm_to_time_t`) with a large enough negative
timezone offset.

This leads to an integer underflow or underflow respectively in the
commit timestamp, which is not caught by `git-commit`, but will cause
other services to fail, such as `git-fsck`, which, for the first case,
reports "badDateOverflow: invalid author/committer line - date causes
integer overflow".

Instead check the timezone offset and fail if the resulting time comes
before the epoch "1970-01-01T00:00:00Z" or after the maximum date
"2099-12-31T23:59:59Z".

Using the REQUIRE_64BIT_TIME prerequisite, make sure that the tests
near the end of Git time (aka end of year 2099) are not attempted on
purely 32-bit systems, as they cannot express timestamp beyond 2038
anyway.

Signed-off-by: Darcy Burke &lt;acednes@gmail.com&gt;
[jc: fixups for 32-bit platforms]
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>date: make DATE_MODE thread-safe</title>
<updated>2024-04-05T22:21:14Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2024-04-05T17:44:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9720d23e8caf4adee44b3a32803a9bb0480118bd'/>
<id>urn:sha1:9720d23e8caf4adee44b3a32803a9bb0480118bd</id>
<content type='text'>
date_mode_from_type() modifies a static variable and returns a pointer
to it.  This is not thread-safe.  Most callers of date_mode_from_type()
use it via the macro DATE_MODE and pass its result on to functions like
show_date(), which take a const pointer and don't modify the struct.

Avoid the static storage by putting the variable on the stack and
returning the whole struct date_mode.  Change functions that take a
constant pointer to expect the whole struct instead.

Reduce the cost of passing struct date_mode around on 64-bit systems
by reordering its members to close the hole between the 32-bit wide
.type and the 64-bit aligned .strftime_fmt as well as the alignment
hole at the end.  sizeof reports 24 before and 16 with this change
on x64.  Keep .type at the top to still allow initialization without
designator -- though that's only done in a single location, in
builtin/blame.c.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Acked-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>date: make "iso-strict" conforming for the UTC timezone</title>
<updated>2024-03-13T23:06:52Z</updated>
<author>
<name>Beat Bolli</name>
<email>bb@drbeat.li</email>
</author>
<published>2024-03-13T22:54:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=69e2bee1a3ba2f9367d55992f401e6365be100ea'/>
<id>urn:sha1:69e2bee1a3ba2f9367d55992f401e6365be100ea</id>
<content type='text'>
ISO 8601-1:2020-12 specifies that a zero timezone offset must be denoted
with a "Z" suffix instead of the numeric "+00:00". Add the correponding
special case to show_date() and a new test.

Changing an established output format which might be depended on by
scripts is always problematic, but here we choose to adhere more closely
to the published standard.

Reported-by: Michael Osipov &lt;michael.osipov@innomotics.com&gt;
Signed-off-by: Beat Bolli &lt;dev+git@drbeat.li&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'en/header-split-cache-h-part-2'</title>
<updated>2023-05-09T23:45:46Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-05-09T23:45:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ccd12a3d6cc62f51b746654ae56e26d92f89ba92'/>
<id>urn:sha1:ccd12a3d6cc62f51b746654ae56e26d92f89ba92</id>
<content type='text'>
More header clean-up.

* en/header-split-cache-h-part-2: (22 commits)
  reftable: ensure git-compat-util.h is the first (indirect) include
  diff.h: reduce unnecessary includes
  object-store.h: reduce unnecessary includes
  commit.h: reduce unnecessary includes
  fsmonitor: reduce includes of cache.h
  cache.h: remove unnecessary headers
  treewide: remove cache.h inclusion due to previous changes
  cache,tree: move basic name compare functions from read-cache to tree
  cache,tree: move cmp_cache_name_compare from tree.[ch] to read-cache.c
  hash-ll.h: split out of hash.h to remove dependency on repository.h
  tree-diff.c: move S_DIFFTREE_IFXMIN_NEQ define from cache.h
  dir.h: move DTYPE defines from cache.h
  versioncmp.h: move declarations for versioncmp.c functions from cache.h
  ws.h: move declarations for ws.c functions from cache.h
  match-trees.h: move declarations for match-trees.c functions from cache.h
  pkt-line.h: move declarations for pkt-line.c functions from cache.h
  base85.h: move declarations for base85.c functions from cache.h
  copy.h: move declarations for copy.c functions from cache.h
  server-info.h: move declarations for server-info.c functions from cache.h
  packfile.h: move pack_window and pack_entry from cache.h
  ...
</content>
</entry>
<entry>
<title>Merge branch 'en/header-split-cache-h'</title>
<updated>2023-04-25T20:56:20Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-04-25T20:56:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0807e57807aaffe2813fffb7704dcc9153f03832'/>
<id>urn:sha1:0807e57807aaffe2813fffb7704dcc9153f03832</id>
<content type='text'>
Header clean-up.

* en/header-split-cache-h: (24 commits)
  protocol.h: move definition of DEFAULT_GIT_PORT from cache.h
  mailmap, quote: move declarations of global vars to correct unit
  treewide: reduce includes of cache.h in other headers
  treewide: remove double forward declaration of read_in_full
  cache.h: remove unnecessary includes
  treewide: remove cache.h inclusion due to pager.h changes
  pager.h: move declarations for pager.c functions from cache.h
  treewide: remove cache.h inclusion due to editor.h changes
  editor: move editor-related functions and declarations into common file
  treewide: remove cache.h inclusion due to object.h changes
  object.h: move some inline functions and defines from cache.h
  treewide: remove cache.h inclusion due to object-file.h changes
  object-file.h: move declarations for object-file.c functions from cache.h
  treewide: remove cache.h inclusion due to git-zlib changes
  git-zlib: move declarations for git-zlib functions from cache.h
  treewide: remove cache.h inclusion due to object-name.h changes
  object-name.h: move declarations for object-name.c functions from cache.h
  treewide: remove unnecessary cache.h inclusion
  treewide: be explicit about dependence on mem-pool.h
  treewide: be explicit about dependence on oid-array.h
  ...
</content>
</entry>
<entry>
<title>treewide: remove cache.h inclusion due to previous changes</title>
<updated>2023-04-24T19:47:33Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2023-04-22T20:17:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5e3f94dfe3c69bc2a711a9dc3b1635e7ff91ab54'/>
<id>urn:sha1:5e3f94dfe3c69bc2a711a9dc3b1635e7ff91ab54</id>
<content type='text'>
Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>treewide: be explicit about dependence on strbuf.h</title>
<updated>2023-04-24T19:47:31Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2023-04-22T20:17:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=69a63fe663874716d2b5bf49b90c550f8279358e'/>
<id>urn:sha1:69a63fe663874716d2b5bf49b90c550f8279358e</id>
<content type='text'>
Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/remove-approxidate-relative'</title>
<updated>2023-04-20T21:33:35Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-04-20T21:33:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fa9172c70af55a013e7fe2c5c3c97ba63002a7e5'/>
<id>urn:sha1:fa9172c70af55a013e7fe2c5c3c97ba63002a7e5</id>
<content type='text'>
The approxidate() API has been simplified by losing an extra
function that did the same thing as another one.

* rs/remove-approxidate-relative:
  date: remove approxidate_relative()
</content>
</entry>
</feed>
