Commit Graph

14159 Commits

Author SHA1 Message Date
Josh Triplett
644c763b76 Document that git_odb is thread-safe
Commit 4ae41f9c63 made `git_odb`
race-free, and added internal locking. Update `docs/threading.md`
accordingly, so that APIs built atop libgit2 (e.g. language bindings)
can count on this.
2021-11-11 00:30:40 +01:00
Edward Thomson
44ec8b5cdf Merge pull request #6108 from libgit2/ethomson/docs_ci
ci: only update docs on push
2021-11-09 09:38:53 -05:00
Edward Thomson
51f6f15d71 ci: only update docs on push
Only update the documentation on a `push`.  We were previously updating the documentation only when not in a `pull_request`, which meant that we would push documentation updates in manual build triggers.
2021-11-09 09:03:06 -05:00
Edward Thomson
358a60e1b4 Merge pull request #6100 from mkhl/tests/instead-of-clar
libgit2_clar is now libgit2_tests
2021-10-28 11:27:28 -04:00
Martin Kühl
f66e7f36ff libgit2_clar is now libgit2_tests
in #6083 the test runner was renamed to libgit2_tests,
but not all references to the old name were updated.
this change changes all of them to use the new name.
2021-10-28 10:25:09 +02:00
Edward Thomson
9b04a3076d Merge pull request #6084 from libgit2/ethomson/cmake
cmake: cleanups and consistency
2021-10-18 08:54:36 -04:00
Edward Thomson
52693ab44e cmake: stylistic refactoring
Ensure that we always use lowercase function names, and that we do not
have spaces preceding open parentheses, for consistency.
2021-10-18 08:30:14 -04:00
Edward Thomson
e1be28c7cc cmake: remove unused STDCALL option
The `STDCALL` option was removed; remove the (unreachable) error
message.
2021-10-18 08:30:14 -04:00
Edward Thomson
8507bf81ea trace: always enabled
There's no need to make tracing opt-in; it should always be included.
2021-10-18 08:30:14 -04:00
Edward Thomson
780faa41c4 cmake: allow USE_ICONV on any Unix 2021-10-18 08:30:14 -04:00
Edward Thomson
7f5b0f0c1a cmake: allow ENABLE_REPRODUCIBLE_BUILDS on macOS
macOS may support ENABLE_REPRODUCIBLE_BUILDS, allow users to opt-in to
it. (Especially since ENABLE_REPRODUCIBLE_BUILDS is not the default.)
2021-10-18 08:30:14 -04:00
Edward Thomson
a89db0e7fe Merge pull request #6083 from libgit2/ethomson/clar_no_more 2021-10-17 17:15:41 -04:00
Edward Thomson
4e14d4c6a6 cmake: BUILD_CLAR is now BUILD_TESTS
Nobody knows what CLAR is.  The test building option should be
`BUILD_TESTS`.
2021-10-17 13:05:32 -04:00
Edward Thomson
e61abdce43 Merge pull request #6078 from libgit2/ethomson/gitstr
`git_buf`: now a public-only API (`git_str` is our internal API)
2021-10-17 10:20:46 -04:00
Edward Thomson
f0e693b18a str: introduce git_str for internal, git_buf is external
libgit2 has two distinct requirements that were previously solved by
`git_buf`.  We require:

1. A general purpose string class that provides a number of utility APIs
   for manipulating data (eg, concatenating, truncating, etc).
2. A structure that we can use to return strings to callers that they
   can take ownership of.

By using a single class (`git_buf`) for both of these purposes, we have
confused the API to the point that refactorings are difficult and
reasoning about correctness is also difficult.

Move the utility class `git_buf` to be called `git_str`: this represents
its general purpose, as an internal string buffer class.  The name also
is an homage to Junio Hamano ("gitstr").

The public API remains `git_buf`, and has a much smaller footprint.  It
is generally only used as an "out" param with strict requirements that
follow the documentation.  (Exceptions exist for some legacy APIs to
avoid breaking callers unnecessarily.)

Utility functions exist to convert a user-specified `git_buf` to a
`git_str` so that we can call internal functions, then converting it
back again.
2021-10-17 09:49:01 -04:00
Edward Thomson
5346be3ddd docs: document git_buf
We have been inconsistent about the way that we handle `git_buf`s
provided by users.  _Usually_ we require that it has been properly
initialized with `GIT_BUF_INIT`, but _sometimes_ we simply overwrite
the data in it regardless.  And even more rarely, we will grow a
user-provided buffer and concatenate data onto it (see
`git_diff_format_email`).

Document the path forward for `git_buf`, which is that we always
require that the buffer is intitialized with `GIT_BUF_INIT`.

`git_diff_format_email` will be kept backward compatible but users
are encouraged to switch to the new `git_email` APIs.
2021-10-17 09:40:20 -04:00
Edward Thomson
66ffac2511 Merge pull request #6082 from libgit2/ethomson/oid
hash: separate hashes and git_oid
2021-10-17 09:25:47 -04:00
Edward Thomson
b5a7af2889 Merge pull request #6092 from libgit2/ethomson/diff_rename_limit 2021-10-13 21:53:27 -04:00
Edward Thomson
1738f7320d diff: document updated rename limit 2021-10-13 11:36:07 -04:00
Edward Thomson
d174381c44 diff: make the default rename_limit 1000
git's default rename limit is 1000, ours should match.
2021-10-13 11:34:56 -04:00
Edward Thomson
f0a0916028 fuzzers: use updated hash functions 2021-10-02 16:34:47 -04:00
Edward Thomson
923364c58e futils: use a particular hash not a git_oid
In `git_futils_readbuffer_updated`, always take a particular hash
instead of a `git_oid`.  This lets us change the checksum algorithm
independently of `git_oid` usage.
2021-10-02 16:34:47 -04:00
Edward Thomson
31ecaca2d3 hash: hash functions operate on byte arrays not git_oids
Separate the concerns of the hash functions from the git_oid functions.
The git_oid structure will need to understand either SHA1 or SHA256; the
hash functions should only deal with the appropriate one of these.
2021-10-02 16:34:47 -04:00
Edward Thomson
2a713da1ec hash: accept the algorithm in inputs 2021-10-01 08:12:07 -04:00
Edward Thomson
3fff59705f hash: don't abbreviate algorithm 2021-10-01 08:12:07 -04:00
Edward Thomson
b7bad55e4b v1.3: very very last-minute changelog updates v1.3.0 2021-09-27 16:09:50 -04:00
Edward Thomson
424812e3d8 Merge pull request #6071 from 257/examples
examples: Free the git_config and git_config_entry after use
2021-09-27 11:23:44 -04:00
Edward Thomson
13f1270a7a v1.3: changelog updates for last-minute changes 2021-09-27 08:58:50 -04:00
Edward Thomson
8c29885e02 Merge pull request #6076 from libgit2/ethomson/oidarray_dispose
oidarray: introduce `git_oidarray_dispose`
2021-09-27 08:57:03 -04:00
Edward Thomson
b6449de323 Merge pull request #6075 from libgit2/ethomson/attr_longpaths 2021-09-27 08:39:55 -04:00
Edward Thomson
853ba20320 Merge pull request #6073 from libgit2/ethomson/attr_lookups 2021-09-27 08:39:39 -04:00
Edward Thomson
a6f6a9f457 Merge pull request #6077 from libgit2/ethomson/strarray
buf: common_prefix takes a string array
2021-09-26 22:09:37 -04:00
Edward Thomson
7e7cfe8acd buf: common_prefix takes a string array
`git_strarray` is a public-facing type.  Change
`git_buf_text_common_prefix` to not use it, and just take an array of
strings instead.
2021-09-26 20:20:57 -04:00
Edward Thomson
0bd132ab82 oidarray: introduce git_oidarray_dispose
Since users are disposing the _contents_ of the oidarray, not freeing
the oidarray itself, the proper cleanup function is
`git_oidarray_dispose`.  Deprecate `git_oidarray_free`.
2021-09-26 18:02:07 -04:00
Edward Thomson
46508fe647 attr_file: don't take the repo as an arg
The `repo` argument is now unnecessary.  Remove it.
2021-09-26 17:46:07 -04:00
Edward Thomson
f5a9f0a258 attr_file: don't validate workdir paths in attr lookups
When looking up attributes for a file, we construct an absolute path
to the queried file within the working directory so that we can accept
both absolute paths and working directory relative paths.  We then trim
the leading working directory path to give us an in-repo path.

Since we only want the in-repo path to look up attributes - and not to
read it from disk - we don't need to validate its length.
2021-09-26 17:46:07 -04:00
Edward Thomson
091bd738d7 attr: ensure lookups are on repo-relative paths
Attribute lookups are done on paths relative to the repository.  Fail if
erroneously presented with an absolute path.
2021-09-25 14:39:01 +01:00
Edward Thomson
3d8749d323 checkout: always provide a path for attribute lookup
Always pass a working-directory relative path to attribute lookups
during checkout.
2021-09-25 14:39:01 +01:00
Edward Thomson
848bd0098a blob: improve create_from_disk attribute lookups
Resolve absolute paths to be working directory relative when looking up
attributes.  Importantly, now we will _never_ pass an absolute path down
to attribute lookup functions.
2021-09-25 14:39:01 +01:00
Edward Thomson
0f4256b8d7 repository: improve hashfile for absolute paths
When `git_repository_hashfile` is handed an absolute path, it determines
whether the path is within the repository's working directory or not.
This is necessary when there is no `as_path` specified.

If the path is within the working directory, then the given path should
be used for attribute lookups (it is the effective `as_path`).  If it is
not within the working directory, then it is _not_ eligible.

Importantly, now we will _never_ pass an absolute path down to attribute
lookup functions.
2021-09-25 14:39:01 +01:00
Edward Thomson
d6c7ca3ea9 win32: posixify the output of p_getcwd
Make p_getcwd match the rest of our win32 path handling semantics.

(This is currently only used in tests, which is why this disparity went
unnoticed.)
2021-09-25 14:39:01 +01:00
Paymon MARANDI
581cfbda85 examples: Free the git_config and git_config_entry after use 2021-09-24 14:14:59 -04:00
Edward Thomson
136901086e changelog: separate releases with a horizontal rule 2021-09-22 15:31:21 -04:00
Edward Thomson
61bbb2d11a changelog: fix typo 2021-09-22 15:28:23 -04:00
Edward Thomson
183da2cc24 Merge pull request #6069 from libgit2/ethomson/v1_3
v1.3.0
2021-09-22 15:25:53 -04:00
Edward Thomson
e7437162ff v1.3: update version number 2021-09-22 08:49:24 -04:00
Edward Thomson
e0531f2c14 v1.3: changelog 2021-09-22 08:49:22 -04:00
Edward Thomson
a5644b8090 Merge pull request #6068 from libgit2/ethomson/diff_enum
diff: update `GIT_DIFF_IGNORE_BLANK_LINES`
2021-09-22 08:48:17 -04:00
Edward Thomson
1ba7c32709 diff: update GIT_DIFF_IGNORE_BLANK_LINES
`GIT_DIFF_IGNORE_BLANK_LINES` needs to be within a (signed) int, per the
`enum` definition of ISO C.
2021-09-21 20:23:44 -04:00
Edward Thomson
efa0d64e03 Merge pull request #6067 from libgit2/ethomson/filter_commit_id
filter: use a `git_oid` in filter options, not a pointer
2021-09-21 13:19:10 -04:00