|
b933c14a
|
2022-02-08T12:22:15
|
|
util: remove `p_mktemp` / `p_mkstemp`
We have our own temporary file creation function now in
`git_futils_mktmp`, remove the others since they may be terrible on some
platforms.
|
|
475c6eba
|
2022-01-17T17:16:02
|
|
win32: improve impl & tests for system path / g4w interop
We look for a Git for Windows installation to use its git config,
so that clients built on libgit2 can interoperate with the Git for
Windows CLI (and clients that are built on top of _it_).
Look for `git` both in the `PATH` and in the registry. Use the _first_
git install in the path, and the first git install in the registry.
Look in both the `etc` dir and the architecture-specific `etc` dirs
(`mingw64/etc` and `mingw32/etc`) beneath the installation root.
Prefer the git in the `PATH` to the git location in the registry so that
users can override that.
Include more tests for this behavior.
|
|
925abee9
|
2022-01-15T20:08:10
|
|
path: introduce git_fs_path_find_executable
Provide a helper function to find an executable in the current process's
PATH.
|
|
29960649
|
2022-01-15T14:13:53
|
|
win32: remove unnecessary findfile structure
|
|
ecbb01f5
|
2022-01-17T00:09:13
|
|
win32: test system paths for gvfs compatibility
|
|
7fd5dfa0
|
2021-12-25T15:25:15
|
|
Correctly detect the share/template folder
With Git for Windows >= 2 the share folder is in an architecture specific subfolder.
This also add support for Git for Windows versions between 2 and 2.24 where also the etc folder is in an architecture specific subfolder.
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
|
f3c1bedf
|
2019-06-28T17:05:57
|
|
Detect installed x64 versions of Git for Windows
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
|
f64568eb
|
2019-06-28T16:49:58
|
|
Do not unconditionally remove the last 4 chars of the directory where git.exe was found
Removal of the last 4 chars is only required for Git for Windows installations in order to find the "root" folder of the Git installation.
Fixes issue #5127.
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
|
7707caaf
|
2019-06-28T16:42:21
|
|
Prevent possible buffer overflow
Could happen if the path to git.exe is near to MAX_PATH and we append a longer subdir such as "share/git-core" to it.
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
|
90df4302
|
2022-01-05T12:18:05
|
|
Fix typos
|
|
1a8b2922
|
2021-11-09T14:15:32
|
|
win32: include correct path header
|
|
95117d47
|
2021-10-31T09:45:46
|
|
path: separate git-specific path functions from util
Introduce `git_fs_path`, which operates on generic filesystem paths.
`git_path` will be kept for only git-specific path functionality (for
example, checking for `.git` in a path).
|
|
f0e693b1
|
2021-09-07T17:53:49
|
|
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.
|
|
d6c7ca3e
|
2021-09-25T14:36:25
|
|
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.)
|
|
379c4646
|
2021-09-09T19:49:04
|
|
Fix coding style for pointer
Make some syntax change to follow coding style.
|
|
c7a195a1
|
2021-08-25T14:11:03
|
|
Merge pull request #6006 from boretrk/c11-warnings
GCC C11 warnings
|
|
4bbe5e6e
|
2021-08-25T18:14:10
|
|
win32: name the dummy union in GIT_REPARSE_DATA_BUFFER
Instead of buf->"typeofbuffer"ReparseBuffer the members will be
referenced with buf->ReparseBuffer."typeofbuffer"
https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_reparse_data_buffer?redirectedfrom=MSDN
calls the union DUMMYUNIONNAME but that looks a bit cluttered.
|
|
efc4e7e5
|
2021-08-25T12:30:06
|
|
Merge pull request #5802 from lhchavez/git-warn-unused-result
Introduce GIT_WARN_UNUSED_RESULT
|
|
b060080e
|
2021-07-30T06:53:49
|
|
Get Win32 builds to build
Previously, the location of `GIT_WARN_UNUSED_RESULT` was causing it to
be included _after_ a bunch of other headers (namely `src/vector.h`),
which broke the build.
This change does two things:
* Moves the `GIT_WARN_UNUSED_RESULT` above most of the `$include`s in
`src/common.h`.
* Stops including `vector.h` from `src/win32/path_w32.c` since the
header itself does not use it.
|
|
e96fc028
|
2021-08-08T13:22:53
|
|
tests: optional test for p_open() with empty path segments
|
|
52505ab5
|
2021-07-07T19:12:02
|
|
Convert long long constant specifiers to stdint macros
|
|
c1aca3fe
|
2021-07-06T23:25:13
|
|
Initial pass at using int64_t instead of long long
Even on systems without C99 where long long and stdint are both
missing, we can shim stdint and point it to any compiler-specific
type (i.e long long, _int64, etc.).
Also next is constant suffixes and determining what needs to
include stdint.
|
|
a6fb72a8
|
2021-05-18T11:51:25
|
|
tests: exit with error on win32 leakcheck
|
|
69c65b9a
|
2019-12-31T12:38:03
|
|
path: bump most Win32 unicode buffer sizes from MAX_PATH to GIT_PATH_MAX
|
|
7efddeb7
|
2021-02-15T15:47:28
|
|
Fix some typos
|
|
4ce8e01a
|
2020-06-17T14:31:11
|
|
Support build with NO_MMAP to disable use of system mmap
* Use pread/pwrite to avoid updating position in file descriptor
* Emulate missing pread/pwrite on win32 using overlapped file IO
|
|
42d5f110
|
2020-12-08T14:33:31
|
|
win32: provide macros for calling conventions
Provide more clarity for Win32 calling conventions - now that we always
compile to __cdecl on Win32, we'll define that as the the libgit2
calling convention. Also offer NTAPI (__stdcall) calling conventions
for things that need callbacks from NTAPI code (eg fiber-local storage).
|
|
c6ebdb29
|
2020-11-22T09:43:06
|
|
win32: use GIT_ASSERT
|
|
8aed4629
|
2020-07-12T18:43:22
|
|
cmake: rename MSVC_CRTDBG to WIN32_LEAKCHECK
|
|
31654a34
|
2020-07-12T18:07:10
|
|
win32: consolidate leak checking initialization
Move leak check initialization into git_win32_leakcheck_global_init, and
call it on library initialization.
|
|
cb4b3bdf
|
2020-07-12T17:49:42
|
|
win32: "crtdbg" is now "leakcheck"
msvc crtdbg is a mouthfull that is not particularly indicative of what
it does. Let's rename it to "win32 leakcheck".
|
|
20450cbe
|
2020-10-14T13:44:59
|
|
Merge pull request #5546 from libgit2/ethomson/init
Refactor "global" state
|
|
4a0dceeb
|
2020-10-11T17:53:10
|
|
Make the Windows leak detection more robust
This change:
* Increases MY_ROW_LIMIT to 2M, since it has been failing in #5595's
tests since it's _super_ close to the limit.
* Calls `git_repository_free()` on a `git_repository` that was being
leaked only in Windows.
* Marks the global `git_repository` on `tests/repo/init.c` as `NULL`
after being freed to make any accidental access more noisy.
* Uses `cl_assert_equal_i()` in `test_trace_windows_stacktrace__leaks`
to make the test failures more actionable.
* Renames the globals in `tests/repo/init.c` so that they don't start
with an underscore.
|
|
e316b0d3
|
2020-05-15T11:47:09
|
|
runtime: move init/shutdown into the "runtime"
Provide a mechanism for system components to register for initialization
and shutdown of the libgit2 runtime.
|
|
8970acb7
|
2020-05-15T10:29:41
|
|
thread: don't use the global tlsdata for thread exit
We want to store a pointer to emulate `pthread_exit` on Windows. Do
this within the threading infrastructure so that it could potentially be
re-used outside of the context of libgit2 itself.
|
|
4853d94c
|
2020-05-14T10:36:35
|
|
global: separate global state from thread-local state
Our "global initialization" has accumulated some debris over the years.
It was previously responsible for both running the various global
initializers (that set up various subsystems) _and_ setting up the
"global state", which is actually the thread-local state for things
like error reporting.
Separate the thread local state out into "threadstate". Use the normal
subsystem initialization functions that we already have to set it up.
This makes both the global initialization system and the threadstate
system simpler to reason about.
|
|
fe12423a
|
2020-05-12T13:08:22
|
|
init: move thread init to git_global_threads_init
Instead of treating win32 thread initialization specially in the win32
git_libgit2_init function, add a git_global_threads_init function.
|
|
dc1deb3b
|
2020-07-01T15:41:38
|
|
Use __GNUC__ macro in the resource script
Fix the default LIBGIT2_FILENAME for GNU windres
|
|
71000441
|
2020-06-16T18:58:07
|
|
Review: Rename the stringize macro
|
|
5c40456b
|
2020-06-16T13:19:02
|
|
Enable building git2.rc resource script with GCC
|
|
a6c9e0b3
|
2020-06-08T12:40:47
|
|
tree-wide: mark local functions as static
We've accumulated quite some functions which are never used outside of
their respective code unit, but which are lacking the `static` keyword.
Add it to reduce their linkage scope and allow the compiler to optimize
better.
|
|
43d7a42b
|
2020-03-08T18:14:09
|
|
win32: don't canonicalize symlink targets
Don't canonicalize symlink targets; our win32 path canonicalization
routines expect an absolute path. In particular, using the path
canonicalization routines for symlink targets (introduced in commit
7d55bee6d, "win32: fix relative symlinks pointing into dirs",
2020-01-10).
Now, use the utf8 -> utf16 relative path handling functions, so that
paths like "../foo" will be translated to "..\foo".
|
|
f2b114ba
|
2020-03-08T18:11:45
|
|
win32: introduce relative path handling function
Add a function that takes a (possibly) relative UTF-8 path and emits a
UTF-16 path with forward slashes translated to backslashes. If the
given path is, in fact, absolute, it will be translated to absolute path
handling rules.
|
|
fb7da154
|
2020-03-08T16:34:23
|
|
win32: clarify usage of path canonicalization funcs
The path canonicalization functions on win32 are intended to
canonicalize absolute paths; those with prefixes. In other words,
things start with drive letters (`C:\`), share names (`\\server\share`),
or other prefixes (`\\?\`).
This function removes leading `..` that occur after the prefix but
before the directory/file portion (eg, turning `C:\..\..\..\foo` into
`C:\foo`). This translation is not appropriate for local paths.
|
|
7d55bee6
|
2020-01-10T12:44:51
|
|
win32: fix relative symlinks pointing into dirs
On Windows platforms, we need some logic to emulate symlink(3P) defined
by POSIX. As unprivileged symlinks on Windows are a rather new feature,
our current implementation is comparatively new and still has some
rough edges in special cases.
One such case is relative symlinks. While relative symlinks to files in
the same directory work as expected, libgit2 currently fails to create
reltaive symlinks pointing into other directories. This is due to the
fact that we forgot to translate the Unix-style target path to
Windows-style. Most importantly, we are currently not converting
directory separators from "/" to "\".
Fix the issue by calling `git_win32_path_canonicalize` on the target.
Add a test that verifies our ability to create such relative links
across directories.
|
|
5c6180b5
|
2019-11-29T11:06:11
|
|
global: convert to fiber-local storage to fix exit races
On Windows platforms, we automatically clean up the thread-local storage
upon detaching a thread via `DllMain()`. The thing is that this happens
for every thread of applications that link against the libgit2 DLL, even
those that don't have anything to do with libgit2 itself. As a result,
we cannot assume that these unsuspecting threads make use of our
`git_libgit2_init()` and `git_libgit2_shutdow()` reference counting,
which may lead to racy situations:
Thread 1 Thread 2
git_libgit2_shutdown()
DllMain(DETACH_THREAD)
git__free_tls_data()
git_atomic_dec() == 0
git__free_tls_data()
TlsFree(_tls_index)
TlsGetValue(_tls_index)
Due to the second thread never having executed `git_libgit2_init()`, the
first thread will clean up TLS data and as a result also free the
`_tls_index` variable. When detaching the second thread, we
unconditionally access the now-free'd `_tls_index` variable, which is
obviously not going to work out well.
Fix the issue by converting the code to use fiber-local storage instead
of thread-local storage. While FLS will behave the exact same as TLS if
no fibers are in use, it does allow us to specify a destructor similar
to the one that is accepted by pthread_key_create(3P). Like this, we do
not have to manually free indices anymore, but will let the FLS handle
calling the destructor. This allows us to get rid of `DllMain()`
completely, as we only used it to keep track of when threads were
exiting and results in an overall simplification of TLS cleanup.
|
|
6460e8ab
|
2019-06-23T18:13:29
|
|
internal: use off64_t instead of git_off_t
Prefer `off64_t` internally.
|
|
8be12026
|
2019-06-23T17:09:22
|
|
mmap: use a 64-bit signed type `off64_t` for mmap
Prefer `off64_t` to `git_off_t` for internal visibility.
|
|
7e1cc296
|
2019-11-25T13:17:42
|
|
mmap: remove unnecessary assertion
64 bit types are always 64 bit.
|
|
50194dcd
|
2019-07-11T15:14:42
|
|
win32: fix symlinks to relative file targets
When creating a symlink in Windows, one needs to tell Windows whether
the symlink should be a file or directory symlink. To determine which
flag to pass, we call `GetFileAttributesW` on the target file to see
whether it is a directory and then pass the flag accordingly. The
problem though is if create a symlink with a relative target path, then
we will check that relative path while not necessarily being inside of
the working directory where the symlink is to be created. Thus, getting
its attributes will either fail or return attributes of the wrong
target.
Fix this by resolving the target path relative to the directory in which
the symlink is to be created.
|
|
a00842c4
|
2019-06-29T09:59:14
|
|
win32: correctly unlink symlinks to directories
When deleting a symlink on Windows, then the way to delete it depends on
whether it is a directory symlink or a file symlink. In the first case,
we need to use `DeleteFile`, in the second `RemoveDirectory`. Right now,
`p_unlink` will only ever try to use `DeleteFile`, though, and thus fail
to remove directory symlinks. This mismatches how unlink(3P) is expected
to behave, though, as it shall remove any symlink disregarding whether
it is a file or directory symlink.
In order to correctly unlink a symlink, we thus need to check what kind
of file this is. If we were to first query file attributes of every file
upon calling `p_unlink`, then this would penalize the common case
though. Instead, we can try to first delete the file with `DeleteFile`
and only if the error returned is `ERROR_ACCESS_DENIED` will we query
file attributes and determine whether it is a directory symlink to use
`RemoveDirectory` instead.
|
|
e54343a4
|
2019-06-29T09:17:32
|
|
fileops: rename to "futils.h" to match function signatures
Our file utils functions all have a "futils" prefix, e.g.
`git_futils_touch`. One would thus naturally guess that their
definitions and implementation would live in files "futils.h" and
"futils.c", respectively, but in fact they live in "fileops.h".
Rename the files to match expectations.
|
|
2f14c4fc
|
2019-06-28T14:39:20
|
|
w32_stack: convert buffer length param to `size_t`
In both `git_win32__stack_format` and `git_win32__stack`, we handle
buffer lengths via an integer variable. As we only ever pass buffer
sizes to it, this should be a `size_t` though to avoid loss of
precision. As we also use it to compare with other `size_t` variables,
this also silences signed/unsigned comparison warnings.
|
|
f48cf5b3
|
2019-06-25T14:46:31
|
|
w32_stack: treat a len as an size_t
|
|
759ec7d4
|
2019-06-15T22:01:00
|
|
win32: cast GetProcAddress to void * before casting
GetProcAddress is prototyped to return a `FARPROC`, which is meant to be
a generic function pointer. It's literally `int (FAR WINAPI * FARPROC)()`
which gcc complains if you attempt to cast to a `void (*)(GIT_SRWLOCK *)`.
Cast to a `void *` before casting to avoid warnings about the arguments.
|
|
3dd1942b
|
2019-06-15T20:43:13
|
|
win32: don't re-define RtlCaptureStackBackTrace
RtlCaptureStackBackTrace is well-defined in Windows, no need to redefine
it.
|
|
f6530438
|
2019-05-25T16:44:59
|
|
win32: stop inlining file_attribute_to_stat
Move `git_win32__file_attribute_to_stat` to a regular function instead
of an inlined function. This helps avoid header ordering issues and
declarations.
|
|
d488c02c
|
2019-05-20T06:31:42
|
|
win32: safely cast path sizes for win api
|
|
cadddaed
|
2019-05-20T06:20:18
|
|
w32: safely cast to int during charset conversion
|
|
2d85c7e8
|
2019-06-14T14:12:19
|
|
posix: remove `p_fallocate` abstraction
By now, we have repeatedly failed to provide a nice
cross-platform implementation of `p_fallocate`. Recent tries to
do that escalated quite fast to a set of different CMake checks,
implementations, fallbacks, etc., which started to look real
awkward to maintain. In fact, `p_fallocate` had only been
introduced in commit 4e3949b73 (tests: test that largefiles can
be read through the tree API, 2019-01-30) to support a test with
large files, but given the maintenance costs it just seems not to
be worht it.
As we have removed the sole user of `p_fallocate` in the previous
commit, let's drop it altogether.
|
|
3d9e82fd
|
2019-05-21T14:59:55
|
|
Merge pull request #4935 from libgit2/ethomson/pcre
Use PCRE for our fallback regex engine when regcomp_l is unavailable
|
|
0fd259ed
|
2019-05-20T12:44:37
|
|
define SYMBOLIC_LINK_FLAG_DIRECTORY if not defined
|
|
fe1fb36e
|
2019-01-13T21:10:50
|
|
win32: move type definitions for improved inclusion
Move some win32 type definitions to a standalone file so that they can
be included before other header files try to use the definitions.
|
|
9ceafb57
|
2019-01-12T22:55:31
|
|
regexec: use pcre as our fallback/builtin regex
Use PCRE 8.42 as the builtin regex implementation, using its POSIX
compatibility layer. PCRE uses ASCII by default and the users locale
will not influence its behavior, so its `regcomp` implementation is
similar to `regcomp_l` with a C locale.
|
|
02683b20
|
2019-01-12T23:06:39
|
|
regexec: prefix all regexec function calls with p_
Prefix all the calls to the the regexec family of functions with `p_`.
This allows us to swap out all the regular expression functions with our
own implementation. Move the declarations to `posix_regex.h` for
simpler inclusion.
|
|
336e98bb
|
2019-05-06T14:51:52
|
|
Moved dwFlags declaration to beginning of scope
|
|
37a7adb5
|
2019-05-05T07:49:09
|
|
Support symlinks for directories in win32
|
|
aeea1c46
|
2019-04-04T15:06:44
|
|
Merge pull request #4874 from tiennou/test/4615
Test that largefiles can be read through the tree API
|
|
32f50452
|
2019-02-22T11:22:28
|
|
p_fallocate: add Windows emulation
Emulate `p_fallocate` on Windows by seeking beyond the end of the file
and setting the size to the current seek position.
|
|
48727e5d
|
2019-02-21T12:27:42
|
|
allocators: extract crtdbg allocator into its own file
The Windows-specific crtdbg allocator is currently mixed into the
crtdbg stacktracing compilation unit, making it harder to find
than necessary. Extract it and move it into the new "allocators/"
subdirectory to improve discoverability.
This change means that the crtdbg compilation unit is now
compiled unconditionally, whereas it has previously only been
compiled on Windows platforms. Thus we now have additional guards
around the code so that it will only be compiled if
GIT_MSVC_CRTDBG is defined. This also allows us to move over the
fallback-implementation of `git_win32_crtdbg_init_allocator` into
the same compilation unit.
|
|
4e3949b7
|
2019-01-30T02:14:11
|
|
tests: test that largefiles can be read through the tree API
|
|
a861839d
|
2019-01-21T10:55:59
|
|
windows: add SSIZE_MAX
Windows doesn't include ssize_t or its _MAX value by default. We are
already declaring ssize_t as SSIZE_T, which is __int64_t on Win64 and
long otherwise. Include its _MAX value as a correspondence to its type.
|
|
f673e232
|
2018-12-27T13:47:34
|
|
git_error: use new names in internal APIs and usage
Move to the `git_error` name in the internal API for error-related
functions.
|
|
7b453e7e
|
2019-01-05T22:12:48
|
|
Fix a bunch of warnings
This change fixes a bunch of warnings that were discovered by compiling
with `clang -target=i386-pc-linux-gnu`. It turned out that the
intrinsics were not necessarily being used in all platforms! Especially
in GCC, since it does not support __has_builtin.
Some more warnings were gleaned from the Windows build, but I stopped
when I saw that some third-party dependencies (e.g. zlib) have warnings
of their own, so we might never be able to enable -Werror there.
|
|
7321cff0
|
2018-11-15T09:17:51
|
|
Merge pull request #4713 from libgit2/ethomson/win_symlinks
Support symlinks on Windows when core.symlinks=true
|
|
204cce66
|
2018-07-03T02:30:34
|
|
win32: add symbolic link support
Enable `p_symlink` to actually create symbolic links, not just create a
fake link (a text file containing the link target).
This now means that `core.symlinks=true` works on Windows platforms
where symbolic links are enabled (likely due to running in Developer
Mode).
|
|
30771261
|
2018-07-03T02:21:17
|
|
win32: use GetFinalPathNameByHandle directly
Now that we've updated to WIN32_WINNT version of Vista or better, we
don't need to dynamically load GetFinalPathNameByHandle and can simply
invoke it directly.
|
|
a34f5b0d
|
2018-10-18T08:57:27
|
|
win32: refactor `git_win32_path_remove_namespace`
Update `git_win32_path_remove_namespace` to disambiguate the prefix
being removed versus the prefix being added. Now we remove the
"namespace", and (may) add a "prefix" in its place. Eg, we remove the
`\\?\` namespace. We remove the `\\?\UNC\` namespace, and replace it
with the `\\` prefix. This aids readability somewhat.
Additionally, use pointer arithmetic instead of offsets, which seems to
also help readability.
|
|
b2e85f98
|
2018-10-17T08:48:43
|
|
win32: rename `git_win32__canonicalize_path`
The internal API `git_win32__canonicalize_path` is far, far too easily
confused with the internal API `git_win32_path_canonicalize`. The
former removes the namespace prefix from a path (eg, given
`\\?\C:\Temp\foo`, it returns `C:\Temp\foo`, and given
`\\?\UNC\server\share`, it returns `\\server\share`). As such, rename
it to `git_win32_path_remove_namespace`.
`git_win32_path_canonicalize` remains unchanged.
|
|
8ab11dd5
|
2018-09-30T16:40:22
|
|
Fix issue with path canonicalization for Win32 paths
|
|
9994cd3f
|
2018-06-25T11:56:52
|
|
treewide: remove use of C++ style comments
C++ style comment ("//") are not specified by the ISO C90 standard and
thus do not conform to it. While libgit2 aims to conform to C90, we did
not enforce it until now, which is why quite a lot of these
non-conforming comments have snuck into our codebase. Do a tree-wide
conversion of all C++ style comments to the supported C style comments
to allow us enforcing strict C90 compliance in a later commit.
|
|
3be73011
|
2018-06-11T18:26:22
|
|
Merge pull request #4436 from pks-t/pks/packfile-stream-free
pack: rename `git_packfile_stream_free`
|
|
ecf4f33a
|
2018-02-08T11:14:48
|
|
Convert usage of `git_buf_free` to new `git_buf_dispose`
|
|
9865cd16
|
2018-03-20T14:23:49
|
|
alloc: make memory allocators use function pointers
Currently, our memory allocators are being redirected to the correct
implementation at compile time by simply using macros. In order to make
them swappable at runtime, this commit reshuffles that by instead making
use of a global "git_allocator" structure, whose pointers are set up to
reference the allocator functions. Like this, it becomes easy to swap
out allocators by simply setting these function pointers.
In order to initialize a "git_allocator", our provided allocators
"stdalloc" and "crtdbg" both provide an init function. This is being
called to initialize a passed in allocator struct and set up its members
correctly.
No support is yet included to enable users of libgit2 to switch out the
memory allocator at a global level.
|
|
496b0df2
|
2018-03-14T10:28:50
|
|
win32: crtdbg: provide independent `free` function
Currently, the `git__free` function is being defined in a single place,
only, disregarding whether we use our standard allocators or the crtdbg
allocators. This makes it a bit harder to convert our code base to use
pluggable allocators, and furthermore makes the border between our two
allocators a bit more blurry.
Implement a separate `git__crtdbg__free` function for the crtdbg
allocator in order to completely separate both allocator
implementations.
|
|
aab8f87b
|
2018-03-14T10:27:13
|
|
win32: crtdbg: internalize implementation of allocators
The crtdbg allocators are currently being implemented as inline
functions as part of the "w32_crtdbg_stacktrace.h" header. As we are
moving towards pluggable allocators with the help of function pointers,
though, we cannot make use of inlining anymore. Instead, we can only
have a single implementation of these allocating functions.
Move all implementations of the crtdbg allocators into
"w32_crtdbg_stacktrace.c".
|
|
abb04caa
|
2018-02-01T15:55:48
|
|
consistent header guards
use consistent names for the #include / #define header guard pattern.
|
|
f38ce9b6
|
2017-05-24T11:09:38
|
|
path: expose `git_path_is_dirsep`
This function has previously been implemented in Windows-specific path
handling code as `path__is_dirsep`. As we will need this functionality
in other parts, extract the logic into "path.h" alongside with a
non-Windows implementation.
|
|
e54cf1a3
|
2017-05-24T11:07:20
|
|
path: expose `git_path_is_absolute`
This function has previously been implemented in Windows-specific path
handling code as `path__is_absolute`. As we will need this functionality
in other parts, extract the logic into "path.h" alongside with a
non-Windows implementation.
|
|
1560b580
|
2017-08-15T10:35:47
|
|
Merge pull request #4288 from pks-t/pks/include-fixups
Include fixups
|
|
bc35fd4b
|
2017-07-18T14:44:29
|
|
win32: provide fast-path for retrying filesystem operations
When using the `do_with_retries` macro for retrying filesystem
operations in the posix emulation layer, allow the remediation function
to return `GIT_RETRY`, meaning that the error was believed to be
remediated, and the operation should be retried immediately, without
a sleep.
This is a slightly more general solution to the problem fixed in #4312.
|
|
1bcdaba2
|
2017-07-18T14:47:28
|
|
fixed win32 p_unlink retry sleep issue
Fixed an issue where the retry logic on p_unlink sleeps before it tries setting a file to write mode causing unnecessary slowdown.
|
|
0c7f49dd
|
2017-06-30T13:39:01
|
|
Make sure to always include "common.h" first
Next to including several files, our "common.h" header also declares
various macros which are then used throughout the project. As such, we
have to make sure to always include this file first in all
implementation files. Otherwise, we might encounter problems or even
silent behavioural differences due to macros or defines not being
defined as they should be. So in fact, our header and implementation
files should make sure to always include "common.h" first.
This commit does so by establishing a common include pattern. Header
files inside of "src" will now always include "common.h" as its first
other file, separated by a newline from all the other includes to make
it stand out as special. There are two cases for the implementation
files. If they do have a matching header file, they will always include
this one first, leading to "common.h" being transitively included as
first file. If they do not have a matching header file, they instead
include "common.h" as first file themselves.
This fixes the outlined problems and will become our standard practice
for header and source files inside of the "src/" from now on.
|
|
459fb8fe
|
2017-06-30T15:35:46
|
|
win32: fix circular include deps with w32_crtdbg
The current order of declarations and includes between "common.h" and
"w32_crtdbg_stacktrace.h" is rather complicated. Both header files make
use of things defined in the other one and are thus circularly dependent
on each other. This makes it currently impossible to compile the
"w32_crtdbg_stacktrace.c" file when including "common.h" inside of
"w32_crtdbg_stacktrace.h".
We can disentangle the mess by moving declaration of the inline crtdbg
functions into the "w32_crtdbg_stacktrace.h" file and adding additional
includes inside of it, such that all required functions are available to
it. This allows us to break the dependency cycle.
|
|
86536c7e
|
2017-04-17T15:40:03
|
|
win32: `remediation` not `cleanup`
The `remediation` function is run in the retry loop in order to attempt
to fix any problems that the prior run encountered. There is nothing
"cleaned up". Clarify the name.
|
|
89d403cc
|
2017-04-05T09:50:12
|
|
win32: enable `p_utimes` for readonly files
Instead of failing to set the timestamp of a read-only file (like any
object file), set it writable temporarily to update the timestamp.
|
|
7ece9065
|
2017-04-03T23:07:16
|
|
win32: make posix emulation retries configurable
POSIX emulation retries should be configurable so that tests can disable
them. In particular, maniacally threading tests may end up trying to
open locked files and need retries, which will slow continuous
integration tests significantly.
|
|
1069ad3c
|
2017-04-03T23:05:53
|
|
win32: do not inherit file descriptors
|
|
d5e6ca1e
|
2017-01-14T18:39:32
|
|
Allow to configure default file share mode for opening files
This can prevent FILE_SHARED_VIOLATIONS when used in tools such as TortoiseGit TGitCache and FILE_SHARE_DELETE, because files can be opened w/o being locked any more.
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
|
92d5a637
|
2017-01-14T17:15:50
|
|
win32: deduplicate code: use p_open in p_creat
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|