Commit Graph

2207 Commits

Author SHA1 Message Date
lhchavez
eab2b0448e Review feedback
* Change the default of the file limit to 0 (unlimited).
* Changed the heuristic to close files to be the file that contains the
  least-recently-used window such that the window is the
  most-recently-used in the file, and the file does not have in-use
  windows.
* Parameterized the filelimit test to check for a limit of 1 and 100
  open windows.
2020-06-26 16:45:25 -07:00
lhchavez
9679df5736 mwindow: set limit on number of open files
There are some cases in which repositories accrue a large number of
packfiles. The existing mwindow limit applies only to the total size of
mmap'd files, not on their number. This leads to a situation in which
having lots of small packfiles could exhaust the allowed number of open
files, particularly on macOS, where the default ulimit is very low
(256).

This change adds a new configuration parameter
(GIT_OPT_SET_MWINDOW_FILE_LIMIT) that sets the maximum number of open
packfiles, with a default of 128. This is low enough so that even macOS
users should not hit it during normal use.

Based on PR #5386, originally written by @josharian.

Fixes: #2758
2020-06-21 07:15:26 -07:00
Patrick Steinhardt
d43d490c38 Merge pull request #5419 from lhchavez/fix-git_index_add_from_buffer-docs
index: Update the documentation for git_index_add_from_buffer()
2020-06-17 17:51:19 +02:00
Edward Thomson
6de8aa7f31 Merge pull request #5532 from joshtriplett/pack-default-path
git_packbuilder_write: Allow setting path to NULL to use the default path
2020-06-02 12:21:22 +01:00
Edward Thomson
5eb48a1408 strarray: deprecate git_strarray_copy
We should not be in the business of copying strings around for users.
We either return a strarray that can be freed, or we take one (and do
not mutate it).
2020-06-01 22:50:28 +01:00
Edward Thomson
51eff5a58b strarray: we should dispose instead of free
We _dispose_ the contents of objects; we _free_ objects (and their
contents).  Update `git_strarray_free` to be `git_strarray_dispose`.
`git_strarray_free` remains as a deprecated proxy function.
2020-06-01 22:50:28 +01:00
Josh Triplett
5278a00611 git_packbuilder_write: Allow setting path to NULL to use the default path
If given a NULL path, write to the object path of the repository.

Add tests for the new behavior.
2020-05-23 16:07:54 -07:00
Edward Thomson
abe2efe1ff Introduce GIT_ASSERT macros
Provide macros to replace usages of `assert`.  A true `assert` is
punishing as a library.  Instead we should do our best to not crash.

GIT_ASSERT_ARG(x) will now assert that the given argument complies to
some format and sets an error message and returns `-1` if it does not.

GIT_ASSERT(x) is for internal usage, and available as an internal
consistency check.  It will set an error message and return `-1` in the
event of failure.
2020-05-11 20:13:54 +01:00
Carl Schwan
9830ab3d25 blame: add option to ignore whitespace changes 2020-04-14 15:50:53 +02:00
Patrick Steinhardt
274b2a017d version.h: bump version to v1.0.0 2020-03-28 18:00:00 +01:00
Patrick Steinhardt
ca782c913b Merge pull request #5464 from pks-t/pks/refdb-backend-docs
refdb_backend: improve callback documentation
2020-03-26 13:57:31 +01:00
Edward Thomson
fad840d73b credentials: provide backcompat for opaque structs
The credential structures are now opaque and defined in
`sys/credential.h`.  However, we should continue to provide them for
backward compatibility, unless `GIT_DEPRECATED_HARD` is set.
2020-03-26 12:06:07 +00:00
Patrick Steinhardt
3bbbe95a9f refdb_backend: improve callback documentation
The callbacks are currently sparsely documented, making it really hard
to implement a new backend without taking a look at the existing
refdb_fs backend. Add documentation to make this task hopefully easier
to achieve.
2020-03-26 10:09:05 +01:00
Josh Bleecher Snyder
a5886e9e0e repository: improve commondir docs
Fixes #5428
2020-03-07 16:05:25 -08:00
lhchavez
cff4ca26de index: Update the documentation for git_index_add_from_buffer()
This change makes the docs reflect reality. The id and size were never
updated in the entry!
2020-02-23 06:33:27 -08:00
Edward Thomson
70062e28d7 version: update the version number to v0.99
This commit also switches our SOVERSION to be "$MAJOR.$MINOR" instead of
"$MINOR", only. This is in preparation of v1.0, where the previous
scheme would've stopped working in an obvious way.
2020-02-19 11:03:08 +01:00
Patrick Steinhardt
aa4cd778b9 Merge pull request #5336 from libgit2/ethomson/credtype
cred: change enum to git_credential_t and GIT_CREDENTIAL_*
2020-01-30 10:40:44 +01:00
Edward Thomson
3f54ba8b61 credential: change git_cred to git_credential
We avoid abbreviations where possible; rename git_cred to
git_credential.

In addition, we have standardized on a trailing `_t` for enum types,
instead of using "type" in the name.  So `git_credtype_t` has become
`git_credential_t` and its members have become `GIT_CREDENTIAL` instead
of `GIT_CREDTYPE`.

Finally, the source and header files have been renamed to `credential`
instead of `cred`.

Keep previous name and values as deprecated, and include the new header
files from the previous ones.
2020-01-26 18:39:41 +00:00
Edward Thomson
4cae9e712c git_libgit2_version: return an int
Stop returning a void for functions, future-proofing them to allow them
to fail.
2020-01-24 15:12:56 -06:00
Edward Thomson
f78f6bd597 error functions: return an int
Stop returning a void for functions, future-proofing them to allow them
to fail.
2020-01-24 15:12:56 -06:00
Edward Thomson
4b331f020e revwalk functions: return an int
Stop returning a void for functions, future-proofing them to allow them
to fail.
2020-01-24 15:12:56 -06:00
Edward Thomson
82050fa1be mempack functions: return an int
Stop returning a void for functions, future-proofing them to allow them
to fail.
2020-01-24 15:12:56 -06:00
Edward Thomson
a3126a72d2 repository functions: return an int
Stop returning a void for functions, future-proofing them to allow them
to fail.
2020-01-24 15:12:56 -06:00
Edward Thomson
cb43274a6b index functions: return an int
Stop returning a void for functions, future-proofing them to allow them
to fail.
2020-01-24 15:12:56 -06:00
Edward Thomson
82154e586c remote functions: return an int
Stop returning a void for functions, future-proofing them to allow them
to fail.
2020-01-24 15:12:56 -06:00
Edward Thomson
3351506aa8 tree functions: return an int
Stop returning a void for functions, future-proofing them to allow them
to fail.
2020-01-24 15:12:56 -06:00
Edward Thomson
2e8c3b0b18 oid functions: return an int
Stop returning a void for functions, future-proofing them to allow them
to fail.
2020-01-24 15:12:56 -06:00
Edward Thomson
9893d376ee git_attr_cache_flush: return an int
Stop returning a void for functions, future-proofing them to allow them
to fail.
2020-01-24 15:12:56 -06:00
Edward Thomson
e9cef7c4b1 http: introduce GIT_ERROR_HTTP
Disambiguate between general network problems and HTTP problems in error
codes.
2020-01-24 10:39:56 -06:00
Edward Thomson
7372573b5f httpclient: support expect/continue
Allow users to opt-in to expect/continue handling when sending a POST
and we're authenticated with a "connection-based" authentication
mechanism like NTLM or Negotiate.

If the response is a 100, return to the caller (to allow them to post
their body).  If the response is *not* a 100, buffer the response for
the caller.

HTTP expect/continue is generally safe, but some legacy servers
have not implemented it correctly.  Require it to be opt-in.
2020-01-24 10:16:36 -06:00
Laurence McGlashan
1bddbd02a6 merge: Return non-const git_repository from git_merge_driver_source_repo accessor. 2020-01-15 10:30:00 +00:00
Remy Suen
5930cf253c Correct typo in name of referenced parameter
Signed-off-by: Remy Suen <remy.suen@gmail.com>
2020-01-02 14:57:55 -05:00
Patrick Steinhardt
2f6f10bb80 Merge pull request #5300 from tiennou/fix/branch-documentation
branch: clarify documentation around branches
2019-12-13 13:35:40 +01:00
Etienne Samson
97b8491b01 refs: rename git_reference__set_name to git_reference__realloc
As git_reference__name will reallocate storage to account for longer
names (it's actually allocator-dependent), it will cause all existing
pointers to the old object to become dangling, as they now point to
freed memory.

Fix the issue by renaming to a more descriptive name, and pass a pointer
to the actual reference that can safely be invalidated if the realloc
succeeds.
2019-12-13 12:01:10 +01:00
Etienne Samson
39f78b0c03 branch: clarify documentation around branches 2019-12-07 10:31:27 +01:00
Josh Bleecher Snyder
64e6db5b6e stash: make comment match code
There is no git_stash_apply_flags_t above.
2019-12-04 14:37:26 -08:00
Edward Thomson
d298f9b287 Merge pull request #5315 from kastiglione/dl/fix-copypaste-in-git_cherrypick_commit-docstring
Fix copy&paste in git_cherrypick_commit docstring
2019-12-01 14:11:56 +11:00
Dave Lee
b7cf4b9e48 Fix copy&paste in git_cherrypick_commit docstring 2019-11-29 14:19:40 -08:00
Patrick Steinhardt
fb439c975a Merge pull request #5306 from herrerog/patchid
diff: complete support for git patchid
2019-11-28 14:41:58 +01:00
Patrick Steinhardt
0b5540b923 Merge pull request #5307 from palmin/hash_sha256
ssh: include sha256 host key hash when supported
2019-11-28 13:56:54 +01:00
Patrick Steinhardt
0e5243b78f Merge pull request #5123 from libgit2/ethomson/off_t
Move `git_off_t` to `git_object_size_t`
2019-11-28 12:42:36 +01:00
Lukas Berk
5ace4ccf39 Move deprecated git_attr_t typedef to previous attribute section 2019-11-27 22:40:17 -05:00
Lukas Berk
3739a15c00 Add attr.h include 2019-11-27 21:31:25 -05:00
Lukas Berk
aea049b63a Add compat typdef for git_attr_t
Some libraries haven't updated to git_attr_value_t and break.  Adding
the comapt typedef as suggested.
2019-11-27 21:24:16 -05:00
Edward Thomson
fefefd1d39 odb: use git_object_size_t for object size
Instead of using a signed type (`off_t`) use a new `git_object_size_t`
for the sizes of objects.
2019-11-22 15:14:13 +11:00
Edward Thomson
4334b1779f blob: use git_object_size_t for object size
Instead of using a signed type (`off_t`) use a new `git_object_size_t`
for the sizes of objects.
2019-11-22 15:10:19 +11:00
Edward Thomson
bed9fc6b59 odb: use git_object_size_t for object size
Instead of using a signed type (`off_t`) use a new `git_object_size_t`
for the sizes of objects.
2019-11-22 15:09:17 +11:00
Edward Thomson
9b04d0be29 types: introduce git_object_size_t
Introduce `git_object_size_t`, an unsigned type that we can use for the
maximum size of git objects.
2019-11-22 15:04:09 +11:00
Anders Borum
48c3f7e1f1 ssh: include sha256 host key hash when supported 2019-11-20 11:24:14 +01:00
Gregory Herrero
b921964b25 diff_print: add support for GIT_DIFF_FORMAT_PATCH_ID.
Git is generating patch-id using a stripped down version of a patch
where hunk header and index information are not present.

Signed-off-by: Gregory Herrero <gregory.herrero@oracle.com>
2019-11-19 09:33:12 +01:00