Commit Graph

3739 Commits

Author SHA1 Message Date
Edward Thomson
d0da6819ec Merge pull request #7057 from kivikakk/diff-stat-alignment
diff: correct diff stat alignment in presence of renames w/ common prefix.
2025-06-05 13:53:57 +01:00
Sven Strickroth
3dc766a875 tag: Refuse to use HEAD as a tagname
Sync with vanilla Git, cf. https://github.com/git/git/commit/bbd445d5efd415

Signed-off-by: Sven Strickroth <email@cs-ware.de>
2025-04-07 21:18:20 +02:00
Talya Connor
31f5c30999 test: failing diff stat test. 2025-03-29 18:16:45 +11:00
Edward Thomson
771ec303d4 benchmarks: introduce --admin flag for admin benchmarks
Some benchmarks require administrative privileges, namely the ones that
blow up the disk cache. Don't run them by default, to avoid obnoxious
sudo password prompts, etc. Users can specify `--admin` to run them.
2025-03-02 20:46:38 +00:00
Edward Thomson
8d8ab0b110 benchmarks: rename cache benchmarks
The default in the world is to have a disk cache; it's exceptional to
_not_. Flip our naming, so that the (exceptional) `nocache` tests are
called out explicitly.
2025-03-02 20:46:38 +00:00
Edward Thomson
48d031f6ab cli: fix benchmark commit interrogation
Don't fail the benchmark script if we can't identify the CLI commit.
2025-03-02 08:56:38 +00:00
Edward Thomson
1cd6872e8f Merge pull request #7008 from libgit2/ethomson/benchmark_version
benchmarks: report commit of build
2025-02-03 17:21:35 +00:00
Edward Thomson
72d49bb0de clar: update to latest version
Update to the latest version (in HEAD) of clar. This affords us improved
test directory creation, and the `cl_invoke` helper macro.
2025-01-23 10:32:52 +00:00
Edward Thomson
1b348a3134 Merge pull request #7026 from emilazy/push-npwwprvzrmmr
conflict tests: check `core.ignorecase`
2025-01-21 13:42:07 -08:00
Emily
96bdc04fbb conflict tests: check core.ignorecase
Not all filesystems on Apple and Windows platforms are
case‐insensitive; this test would previously fail on a
case‐sensitive APFS volume.
2025-01-21 21:19:32 +00:00
Edward Thomson
3eadce3d0b Merge pull request #7019 from vapier/main
alternates: allow relative paths in all repositories
2025-01-21 13:04:10 -08:00
Edward Thomson
99dbff8d7c Merge pull request #7025 from libgit2/ethomson/test_updates
Test updates
2025-01-21 05:10:01 -08:00
Edward Thomson
c48364cd6a filter: set a temporary sysdir in test
The filter tests mutate state, and should set a temporary sysdir to do
so.
2025-01-20 22:45:59 +00:00
Edward Thomson
21af9ec86c test: set a temporary PROGRAMDATA directory
Like we set temporary system and global configuration directories, we
need to set a programdata directory for safe test handling.
2025-01-20 22:45:53 +00:00
Mike Frysinger
17cbd2eae0 alternates: allow relative paths in all repositories
Git does not limit relative paths in alternates to the first
repository, so libgit2 shouldn't either.
2025-01-15 21:25:30 -05:00
Edward Thomson
906623b8f9 attr: honor ignorecase in attribute matching
`.gitattributes` is case-insensitive when `core.ignorecase=true`.
2025-01-15 22:44:51 +00:00
Edward Thomson
f9e9ddd884 flamegraph: theme for libgit2 benchmarks site 2025-01-14 12:48:28 +00:00
Edward Thomson
008c6f7984 benchmarks: optionally generate and publish flamegraphs 2025-01-13 21:23:02 +00:00
Edward Thomson
dfbdaa28a5 benchmark: introduce profiling support
Introduce `--profile` support to the benchmark helper script, which will
invoke `perf` on Linux. Additionally, add a `--flamegraph` output
option based on that.
2025-01-13 21:21:17 +00:00
Edward Thomson
6fedfd3237 Add benchmark for large-ish (250mb) index-pack 2025-01-11 21:58:19 +00:00
Edward Thomson
343c2cbae8 benchmarks: report commit of build
It can be useful to report the commit ID during benchmarks to track down
regressions; leverage the addition of that in `git version` during
benchmark runs.
2025-01-09 23:44:23 +00:00
Edward Thomson
436f4e7d96 benchmarks: update path to baseline cli
The `fullpath` function takes the cli, but doesn't keep the cli.
2025-01-09 21:45:11 +00:00
Edward Thomson
caa65e0e9f Merge pull request #7000 from libgit2/ethomson/object_type 2025-01-03 14:01:24 +00:00
Edward Thomson
23da3a8f3c object: remove OFS_DELTA and REF_DELTA values
Deltas are not objects, they're entries in a packfile. Remove them from
the object enum.
2025-01-03 13:28:19 +00:00
Edward Thomson
2d5942571c object: introduce type_is_valid
There's no such thing as a "loose object type" or a "packed object
type". There are only object types. Introduce `type_is_valid` and
deprecate `typeisloose`.
2025-01-03 13:28:19 +00:00
Edward Thomson
666bbed4d4 Merge pull request #6998 from peter15914/fix_check_calloc
FIx potential null dereference
2025-01-03 09:00:00 +00:00
Edward Thomson
dafe14ce65 Merge pull request #6346 from libgit2/ethomson/reference_cmp
refs: make `git_reference_cmp` consider the name
2025-01-02 23:14:40 +00:00
peter15914
01c16e6aa7 transport: сheck a pointer allocation result
GIT_ERROR_CHECK_ALLOC was added to check the return value of git__calloc().
2025-01-03 01:22:53 +05:00
Edward Thomson
a0d432660a Merge pull request #6994 from libgit2/ethomson/cmake 2025-01-02 17:56:41 +00:00
Edward Thomson
c26d8a8b54 sha256: further API simplifications for OID parsing
Introduce `git_oid_from_string`, `git_oid_from_prefix`, and
`git_oid_from_raw`, all of which take a `git_oid_t` that indicates what
type of OID should be parsed (SHA1 or SHA256).

This allows users to continue to use `git_oid_fromstr` without any code
changes, while remaining in a SHA1 world.

Note that these are not perfect analogs to the `fromstr` APIs.

* `git_oid_from_string` now takes a NUL terminated string, instead of
  allowing for non-NUL terminated strings. Adding a NUL check feels like
  an important safety consideration for C strings.
* `git_oid_from_prefix` should be used for an OID substring and length.

Previous usages of `git_oid_fromstr` with non-NUL terminated strings
should move to `git_oid_from_prefix` with the hexsize for the given OID
type.
2025-01-02 13:13:59 +00:00
Edward Thomson
56e2a85643 sha256: simplify API changes for sha256 support
There are several places where users may want to specify the type of
object IDs (sha1 or sha256) that should be used, for example, when
dealing with repositories, indexes, etc.

However, given that sha256 support remains disappointingly uncommon in
the wild, we should avoid hard API breaks when possible. Instead, update
these APIs to have an "extended" format (eg, `git_odb_open_ext`) that
provides an options structure with oid type information.

This allows callers who do care about sha256 to use it, and callers who
do not to avoid gratuitous API breakage.
2025-01-02 13:13:59 +00:00
Edward Thomson
c4c284e46f cmake: standardize HTTPS backend definitions
There were a few oddities around HTTPS provider selection: namely,
`GIT_OPENSSL_DYNAMIC` implied `GIT_OPENSSL`, which made a bit of sense,
until we added FIPS support. In addition, dynamic OpenSSL for _hashes_
and dynamic OpenSSL for HTTPS was conflated in a few places.

Untangle these, and make `GIT_HTTPS_*` the define, for consistency with
other feature provider selection.
2025-01-02 12:36:11 +00:00
Edward Thomson
9efdbe3834 cmake: standardize leak check option
The `GIT_WIN32_LEAKCHECK` option is a debugging option, so it should be
`GIT_DEBUG_LEAKCHECK_WIN32`
2025-01-02 12:36:11 +00:00
Edward Thomson
2b581ef517 cmake: update threads
For consistency with other backend/provider selection, allow
`USE_THREADS` to select the threads provider.
2025-01-02 12:36:11 +00:00
Edward Thomson
890d70856c cmake: update nanosecond selection
For consistency, specify the nanosecond option in the same way as other
options, and identify it as such. Split the detection of platform
support (`FindStatNsec`) and its selection (`SelectNsec`).
2025-01-02 12:36:11 +00:00
Edward Thomson
c9974d28b2 cmake: update Negotiate backend selection 2025-01-02 12:36:11 +00:00
Edward Thomson
fb59acb246 cmake: update NTLM feature enablement 2025-01-02 12:36:09 +00:00
Edward Thomson
9ea1f6d4ed cmake: standardize iconv options 2025-01-02 11:45:47 +00:00
Edward Thomson
c4a65c34c2 cmake: standardize builtin sha1dc selection
All `USE_*` options are now `builtin`. Use that for the builtin sha1dc
implementation, keeping `CollisionDetection` for backward compatibility.
2025-01-02 11:45:47 +00:00
Edward Thomson
ca2a241e4c repo: workdir_path implies no dotgit in init
When specifying a separate working directory path, the given repository
path should never have a `.git` directory created beneath it. That
simply doesn't make sense.

As a result, the `GIT_REPOSITORY_INIT_NO_DOTGIT_DIR` now _also_ no
longer makes sense. It would only ever be a sensible option when one
wanted a separate `.git` directory and working directory, otherwise the
git files and working directory files would be comingled. Remove the
option entirely.
2024-12-30 20:36:13 +00:00
Edward Thomson
5350142b9b Merge pull request #6981 from libgit2/ethomson/gitlink_newline 2024-12-27 17:17:35 +00:00
Edward Thomson
a844a6cf23 repo: put a newline on the .git link file
The `.git` file, when containing a `gitdir: ` link, should be suffixed
with a trailing newline.
2024-12-27 16:38:26 +00:00
Edward Thomson
0c27a85b41 repo: don't require option when template_path is specified
When a `template_path` is explicitly specified, don't _also_ require an
option to indicate that we should use templates. We, obviously, should.
2024-12-27 16:20:11 +00:00
Edward Thomson
ccc202802c Merge pull request #6962 from ryan-ph/ryanpham/negative-refspec/remote
remote: Handle fetching negative refspecs
2024-12-24 23:55:06 +00:00
Ryan Pham
099e62ca03 remote: Don't use designated initializer 2024-12-24 10:42:57 +09:00
Edward Thomson
536f868be6 Merge pull request #6973 from kempniu/ignore-shallow-packets-during-ack-processing
smart: ignore shallow/unshallow packets during ACK processing
2024-12-23 20:15:50 +00:00
Michał Kępień
bed00cd032 smart: ignore shallow/unshallow packets during ACK processing
In RPC mode (https), the client sends its list of shallow commits at the
beginning of each request during packfile negotiation, so that the
remote endpoint keeps context.  This causes the remote to prepend
appropriate shallow/unshallow packets to each response sent back to the
client.

However, the store_common() helper function (used in multi_ack mode)
does not cater for this, returning as soon as it encounters any packet
different than an ACK packet and therefore leaving the rest of the HTTP
buffer unprocessed.  This in turn causes subsequent iterations of the
while loop processing ACK packets to process data returned by older HTTP
requests instead of the current one, messing up the packfile negotiation
process.  Given that the wait_while_ack() helper function (called after
the client signals to the remote that it is ready to receive packfile
data) correctly skips over shallow/unshallow packets, packfile contents
can still be received successfully in some cases (depending on message
framing); in some other ones, though (particularly when
git_smart__download_pack() processes an HTTP buffer starting with
shallow/unshallow packets), the fetching process fails with an
"incomplete pack header" error due to the flush packet terminating a set
of shallow/unshallow packets being incorrectly interpreted as the flush
packet indicating the end of the packfile (making the code behave as if
no packfile data was sent by the remote).

Fix by ignoring shallow/unshallow packets in the store_common() helper
function, therefore making the ACK processing logic work on the correct
HTTP buffers and ensuring that git_smart__download_pack() is not called
until packfile negotiation is actually finished.
2024-12-22 23:32:23 +01:00
Edward Thomson
19a031d075 Introduce git_libgit2_feature_backend API
Provide a mechanism to understand the backend provider for feature
within libgit2. For example, one can query the mechanism that provides
HTTPS by asking for the backend for the `GIT_FEATURE_HTTPS`.

This is particularly useful for features that are not completely
isomorphic; the HTTPS providers may have slightly different
functionality that can be controlled (eg, certificates or cipher
support). And the SSH feature is _very_ different between libssh2 and
OpenSSH.

It may also be useful to understand the support for things like the SHA1
or SHA256 backends to ensure that sha1dc is used, or that FIPS mode is
enabled.
2024-12-22 15:37:56 +00:00
Edward Thomson
f866bb97bf features: move version tests out of features test
Move the test for querying version information out of the
`core::features` test and into the `core::version` test.
2024-12-22 08:44:37 +00:00
Edward Thomson
6aa9bc4a97 midx: add options to writer function
Provide an options structure to MIDX writing. This allows us to
specify information (like OID type) during writer creation.
2024-12-18 16:27:46 +00:00