summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* worktree: update prunable to reflect refactoringsEdward Thomson2023-05-161-11/+11
| | | | | PR #5712 predates several refactorings to move the utility code into a more general purpose codebase. Update to reflect the refactorings.
* Refactor git_worktree_is_prunable slightly to fix memory leakReginald McLean2023-05-161-10/+16
|
* Added check if gitdir exists in is_prunable()Reginald McLean2023-05-161-0/+9
| | | | Fixes #5598
* win32: use WSAGetLastError to determine blockingEdward Thomson2023-05-131-1/+14
|
* win32: getsockopt takes a `char *` instead of a `void *`Edward Thomson2023-05-131-1/+2
| | | | Monsters.
* cmake: use `check_symbol_exists` for rand functionsEdward Thomson2023-05-131-2/+2
| | | | | `check_symbol_exists` is superior to `check_function_exists`; use it consistently in our cmake configuration
* posix: use WSAPoll on win32Edward Thomson2023-05-133-2/+10
|
* posix: introduce p_poll emulation with selectEdward Thomson2023-05-135-5/+85
| | | | Not all systems have poll(2); emulate it with select(2).
* streams: sockets are non-blocking and can timeoutEdward Thomson2023-05-133-25/+226
| | | | | | | | | | | | | | | Make socket I/O non-blocking and add optional timeouts. Users may now set `GIT_OPT_SET_SERVER_CONNECT_TIMEOUT` to set a shorter connection timeout. (The connect timeout cannot be longer than the operating system default.) Users may also now configure the socket read and write timeouts with `GIT_OPT_SET_SERVER_TIMEOUT`. By default, connects still timeout based on the operating system defaults (typically 75 seconds) and socket read and writes block. Add a test against our custom testing git server that ensures that we can timeout reads against a slow server.
* net: move `gitno` buffer to `staticstr`Edward Thomson2023-05-1320-235/+151
| | | | | | | | The `gitno` buffer interface is another layer on top of socket reads. Abstract it a bit into a "static string" that has `git_str` like semantics but without heap allocation which moves the actual reading logic into the socket / stream code, and allows for easier future usage of a static / stack-allocated `git_str`-like interface.
* net: move rfc2818 hostname / wildcard matching to utilEdward Thomson2023-05-135-65/+67
|
* stransport: store error informationEdward Thomson2023-05-131-11/+28
| | | | | | We lose some error information from the read / write callbacks to stransport. Store our own error value in the object so that we can ensure that we rely upon it.
* util: make monotonic time fn return msEdward Thomson2023-05-137-43/+56
| | | | | | | | | | | | | | | | | `git__timer` is now `git_time_monotonic`, and returns milliseconds since an arbitrary epoch. Using a floating point to store the number of seconds elapsed was clever, as it better supports the wide range of precision from the different monotonic clocks of different systems. But we're a version control system, not a real-time clock. Milliseconds is a good enough precision for our work _and_ it's the units that system calls like `poll` take and that our users interact with. Make `git_time_monotonic` return the monotonically increasing number of milliseconds "ticked" since some arbitrary epoch.
* threadstate: don't use an unnecessary macroEdward Thomson2023-05-133-11/+9
| | | | | Now that we've reduced the usage of GIT_THREADSTATE, remove it entirely in favor of git_threadstate_get().
* oid: don't assume thread local state was initializedEdward Thomson2023-05-134-12/+44
| | | | | | git_oid_tostr_s could fail if thread-local state initialization fails. In that case, it will now return `NULL`. Callers should check for `NULL` and propagate the failure.
* errors: don't rely on tls data workingEdward Thomson2023-05-131-13/+68
| | | | | | Thread-local storage data may fail to initialize; in this case, do not try to set the error message into it. When the thread state has not been initialized, return a hardcoded message to that affect.
* errors: drop unneccessary g_git prefixEdward Thomson2023-05-131-6/+6
|
* Merge pull request #6561 from libgit2/ethomson/xdiffEdward Thomson2023-05-131-0/+2
|\ | | | | Update xdiff to git 2.40.1's version
| * util: add GIT_UNUSED_ARGEdward Thomson2023-05-111-0/+2
| | | | | | | | | | Add `GIT_UNUSED_ARG` which is an attribute for arguments, for compatibility with dependencies.
* | Merge pull request #6558 from DimitryAndric/fix-qsort-variants-2Edward Thomson2023-05-123-22/+24
|\ \ | |/ |/| Work around -Werror problems when detecting qsort variants
| * cmake: refactor `check_prototype_definition`Edward Thomson2023-05-121-14/+4
| | | | | | | | | | Introduce `check_prototype_definition_safe` that is safe for `Werror` usage.
| * cmake: simplify QSORT namesEdward Thomson2023-05-123-18/+20
| | | | | | | | `QSORT_R` and `QSORT_S` -> `QSORT`
| * Work around -Werror problems when detecting qsort variantsDimitry Andric2023-05-091-0/+10
| | | | | | | | | | | | | | If `ENABLE_WERROR` is on, the CMake configure tests for the `qsort_r` and `qsort_s` variants may fail due to warnings about unused functions or unused parameters. These warnings can be ignored, so disable them specifically for running those tests.
* | Merge pull request #6557 from libgit2/ethomson/shallowEdward Thomson2023-05-0922-71/+897
|\ \ | |/ |/| Shallow (#6396) with some fixes from review
| * fetch: remove `unshallow` optionEdward Thomson2023-05-091-3/+1
| | | | | | | | | | The `depth` field is suitable to specify unshallowing; provide an enum to aide in specifying the `unshallow` value.
| * oid: use an oid array instead of shallowarrayEdward Thomson2023-05-0914-99/+174
| | | | | | | | | | | | Users should provide us an array of object ids; we don't need a separate type. And especially, we should not be mutating user-providing values. Instead, use `git_oid *` in the shallow code.
| * cli: add --depth option to cloneEdward Thomson2023-05-081-6/+22
| |
| * grafts: make `from_file` be `open_or_refresh`Edward Thomson2023-05-083-8/+18
| | | | | | | | | | | | | | | | | | | | The semantics of `from_file` are weird - it looks like a function that just opens a file, but it actually inspects the pointer, which is unexpected and could make things very crashy. Make an `open` function that just does an open, and move the magic to `open_or_refresh` whose name better indicates that it may do weird stuff.
| * shallow: don't default to -1 for depthEdward Thomson2023-05-082-9/+6
| | | | | | | | | | Depth of `0` should indicate full depth. Disallow negative values (they may have a future meaning) and use `0` as the default.
| * grafts: handle SHA256 graft filesEdward Thomson2023-05-083-10/+22
| |
| * grafts: use `git_parse` to parse object IDsEdward Thomson2023-05-081-9/+7
| | | | | | | | Don't mix parsing by hand and using `git_parse` to parse.
| * futils: use SHA256 for checksums alwaysEdward Thomson2023-05-082-7/+11
| | | | | | | | | | | | | | | | Use SHA256 for file checksums. SHA1 makes no sense as a default in 2023. Given that we're just looking at a file checksum to see if it's changed, this does not need to take repository's OID type into account or otherwise be configurable.
| * shallow: avoid unnecessary pkt freeEdward Thomson2023-05-081-7/+9
| | | | | | | | Looks like a double-free here.
| * transport: transports understand oid typeEdward Thomson2023-04-252-10/+22
| | | | | | | | Teach the smart transport more about oid types, instead of assuming SHA1.
| * shallow: don't assume SHA1Edward Thomson2023-04-252-26/+46
| |
| * smart: validate shallow/unshallow pktsEdward Thomson2023-04-251-6/+24
| |
| * shallow: use GIT_ASSERT (not assert)Edward Thomson2023-04-242-11/+13
| |
| * shallow: remove feature flagEdward Thomson2023-04-245-15/+4
| | | | | | | | | | The opt mechanism isn't _really_ meant to be for feature flags, and it's weird to feature flag shallow / unshallow at all.
| * Merge remote-tracking branch 'origin/main' into shallow-clone-networkEdward Thomson2023-04-22105-5419/+2906
| |\
| * | Update src/libgit2/fetch.cLaurence McGlashan2023-03-101-1/+1
| | | | | | | | | Co-authored-by: Qix <Qix-@users.noreply.github.com>
| * | Merge branch 'shallow-clone-network' of https://github.com/mathworks/libgit2 ↵lmcglash2023-03-101-1/+1
| |\ \ | | | | | | | | | | | | into shallow-clone-network
| | * | Apply suggestions from code reviewLaurence McGlashan2023-03-101-1/+1
| | | | | | | | | | | | Co-authored-by: Qix <Qix-@users.noreply.github.com>
| * | | Remove stray commalmcglash2023-03-101-2/+2
| |/ /
| * | Fix merge errorlmcglash2023-03-101-26/+17
| | |
| * | Merge commit 'd066d0d95c43e97df6624292f3f527f9372ca8fe'lmcglash2023-03-1083-1168/+2752
| |\ \
| * | | fix shallow array searchYuang Li2022-09-061-1/+1
| | | |
| * | | remove unused statementsYuang Li2022-09-051-1/+0
| | | |
| * | | fix error handlingYuang Li2022-09-051-2/+2
| | | |
| * | | fix depth initialisationYuang Li2022-09-051-3/+6
| | | |
| * | | refactor smart_pktYuang Li2022-08-311-2/+2
| | | |