When parsing URLs, track whether the port number was explicitly
specified or not. We track this separately from whether the port is the
_default_ port. This is so that we can discern between URLs that have
the default port explicitly specified or not.
For example: scp://host:22/foo and scp://host/foo are equivalent in
terms of functionality, but are not semantically equivalent.
A user might wish to specify scp://host:22/foo in order to explicitly
ensure that we connect on port 22, which might override (for example) a
different configuration option.
When `git_odb_stream` is a read stream, `hash_ctx` is not used.
Therefore, check if `hash_ctx` can be freed during the release.
This allows implementers of custom ODB backends to not worry about
the creation of `hash_ctx` for now.
Git introduced this 100 MiB limit in commits 3c50032ff528 (attr: ignore
overly large gitattributes files, 2022-12-01) and e7c3d1ddba0b (dir.c:
reduce max pattern file size to 100MB, 2024-06-05).
Signed-off-by: Sven Strickroth <email@cs-ware.de>
People who are doing a commit expect a unified timestamp between
author and committer information when we're using the current timestamp.
Provide a single function that returns both author and committer
information so that they can have an identical timestamp when none is
specified in the environment.
Making the various pieces that create commits automatically (eg, rebase)
start paying attention to the environment variables is a Big Change.
For now, this is a big change in defaults; we should treat it as
breaking. We don't move to this by default; we may add `from_env` or
`honor_env` type of API surface in the future.
realpath(3) _may_ allocate strings (if the second param is NULL) using
the system allocator. However, callers need an assurance that they can
free memory using git__free. If we made realpath do an allocation, then
make sure that we strdup it into our allocator's memory.
More importantly, avoid this behavior by always providing a buffer to
p_realpath invocations.
Instead of tweaking the `stdalloc` allocator when
`GIT_DEBUG_STRICT_ALLOC` is defined, actually create a debugging
allocator. This allows us to ensure that we are strict about things like
not expecting `malloc(0)` to do something useful, but we can also
introduce an excessively pedantic `realloc` implementation that _always_
creates a new buffer, throws away its original `ptr`, and overwrites the
data that's there with garbage. This may be helpful to identify places
that make assumptions about realloc.
Avoid sloppy aliasing in our (re-)allocation, which is undefined
behavior. This has been problematic before and was helped by `volatile`
(see b62a6a13b2) but that is not
technically correct, and some compilers / architectures do not
understand that `ptr` is changing due to its aliasing.
Just make `git_array_alloc` behave like `realloc`, taking a `void *` and
returning a `void *`.