src/win32


Log

Author Commit Date CI Message
Edward Thomson 909d5494 2016-12-29T12:25:15 giterr_set: consistent error messages Error messages should be sentence fragments, and therefore: 1. Should not begin with a capital letter, 2. Should not conclude with punctuation, and 3. Should not end a sentence and begin a new one
Boris Barbulovski 9af59f5d 2016-12-06T03:08:52 Properly pass `wchar *` type to giterr_set
Boris Barbulovski 86364af9 2016-11-20T11:30:45 Properly pass `wchar *` type to giterr_set
Edward Thomson 82f15896 2016-11-18T07:19:22 threads: introduce `git_thread_exit` Introduce `git_thread_exit`, which will allow threads to terminate at an arbitrary time, returning a `void *`. On Windows, this means that we need to store the current `git_thread` in TLS, so that we can set its `return` value when terminating. We cannot simply use `ExitThread`, since Win32 returns `DWORD`s from threads; we return `void *`.
Arthur Schreiber ab96ca55 2016-10-06T13:15:31 Make sure we use the `C` locale for `regcomp` on macOS.
Patrick Steinhardt aab266c9 2016-06-20T20:07:33 threads: add platform-independent thread initialization function
Patrick Steinhardt 8aaa9fb6 2016-06-20T18:21:42 win32: rename pthread.{c,h} to thread.{c,h} The old pthread-file did re-implement the pthreads API with exact symbol matching. As the thread-abstraction has now been split up between Unix- and Windows-specific files within the `git_` namespace to avoid symbol-clashes between libgit2 and pthreads, the rewritten wrappers have nothing to do with pthreads anymore. Rename the Windows-specific pthread-files to honor this change.
Patrick Steinhardt a342e870 2016-06-20T18:28:00 threads: remove now-useless typedefs
Patrick Steinhardt 4f10c1e6 2016-06-20T19:40:45 threads: remove unused function pthread_num_processors_np The function pthread_num_processors_np is currently unused and superseded by the function `git_online_cpus`. Remove the function.
Patrick Steinhardt 6551004f 2016-06-20T17:49:47 threads: split up OS-dependent rwlock code
Patrick Steinhardt 139bffa0 2016-06-20T17:20:13 threads: split up OS-dependent thread-condition code
Patrick Steinhardt 20d078df 2016-06-20T19:48:19 threads: remove unused function pthread_cond_broadcast
Patrick Steinhardt 1c135405 2016-06-20T17:07:14 threads: split up OS-dependent mutex code
Patrick Steinhardt faebc1c6 2016-06-20T17:44:04 threads: split up OS-dependent thread code
Carlos Martín Nieto 87c18197 2016-03-16T19:05:11 Split the page size from the mmap alignment While often similar, these are not the same on Windows. We want to use the page size on Windows for the pools, but for mmap we need to use the allocation granularity as the alignment. On the other platforms these values remain the same.
Edward Thomson 3d6a42d1 2016-02-25T11:23:19 nsec: support NDK's crazy nanoseconds Android NDK does not have a `struct timespec` in its `struct stat` for nanosecond support, instead it has a single nanosecond member inside the struct stat itself. We will use that and use a macro to expand to the `st_mtim` / `st_mtimespec` definition on other systems (much like the existing `st_mtime` backcompat definition).
Carlos Martín Nieto b85d0afd 2016-02-18T15:11:02 Merge pull request #3606 from ethomson/drop_xp win32: drop xp support in WideCharToMultiByte
Edward Thomson c4d23928 2016-02-11T15:41:07 fstat: use our custom `stat`
Edward Thomson 35439f59 2016-02-11T12:24:21 win32: introduce p_timeval that isn't stupid Windows defines `timeval` with `long`, which we cannot sanely cope with. Instead, use a custom timeval struct.
Edward Thomson 494e61b8 2016-02-09T17:44:59 win32: drop xp support in WideCharToMultiByte
Jacques Germishuys e78e8fae 2015-11-20T20:22:38 Make stat.st_size a __int64 not a uint64_t
Carlos Martín Nieto 75a0ccf5 2015-11-12T19:53:09 Merge pull request #3170 from CmdrMoozy/nsec_fix git_index_entry__init_from_stat: set nsec fields in entry stats
Carlos Martín Nieto 8c7c5fa5 2015-10-20T17:42:42 config: add a ProgramData level This is where portable git stores the global configuration which we can use to adhere to it even though git isn't quite installed on the system.
Axel Rasmussen c7b17fb5 2015-10-01T18:01:32 Merge branch 'master' into nsec_fix_next
Edward Thomson 92a47824 2015-09-22T23:10:56 win32: propogate filename too long errors
Axel Rasmussen 360dd4da 2015-06-23T10:02:48 win32: define our own POSIX struct stat, and support USE_NSEC
Edward Thomson e164ddb1 2015-09-17T12:23:19 win32: return EACCES in `p_lstat` Don't coalesce all errors into ENOENT. At least identify EACCES. All callers should be handling this case already, as the POSIX `lstat` will return this.
Edward Thomson aa06ecaf 2015-08-28T19:30:08 Merge pull request #3352 from ethomson/hidden win32: ensure hidden files can be staged
John Haley eba784d2 2015-08-05T10:19:06 Fix duplicate basenames to support older VS With Visual Studio versions 2008 and older they ignore the full path to files and only check the basename of the file to find a collision. Additionally, having duplicate basenames can break other build tools like GYP. This fixes https://github.com/libgit2/libgit2/issues/3356
Edward Thomson bdec3363 2015-08-03T17:48:33 win32: ensure hidden files can be staged
Carlos Martín Nieto ea445e06 2015-07-07T00:48:17 Merge pull request #3288 from ethomson/getenv git__getenv: utf-8 aware env reader
Edward Thomson e069c621 2015-07-02T09:25:48 git__getenv: utf-8 aware env reader Introduce `git__getenv` which is a UTF-8 aware `getenv` everywhere. Make `cl_getenv` use this to keep consistent memory handling around return values (free everywhere, as opposed to only some platforms).
Jeff Hostetler 827b954e 2015-06-28T06:56:02 Reserve aux_id 0; sort leaks by aux_id. Fix cmp.
Jeff Hostetler 93b42728 2015-06-09T14:38:30 Include stacktrace summary in memory leak output.
Edward Thomson 121c3171 2015-06-16T15:18:04 Introduce p_utimes and p_futimes Provide functionality to set the time on a filesystem entry, using utimes or futimes on POSIX type systems or SetFileTime on Win32.
Edward Thomson cd39e4e2 2015-04-29T18:12:51 git_buf_put_w: introduce utf16->utf8 conversion
Edward Thomson f63a1b72 2015-04-29T17:23:02 git_path_diriter: use FindFirstFile in win32 Using FindFirstFile and FindNextFile in win32 allows us to use the directory information that is returned, instead of us having to get the file attributes all over again, which is a distinct cost savings on win32.
Edward Thomson 35c1d207 2015-04-29T14:03:20 git_win32_path_dirload_with_stat: removed
Edward Thomson 544139f5 2015-04-28T16:39:47 win32: keep full path for realpath usage
Edward Thomson c074d7a4 2015-04-28T12:24:08 win32: mimic git_path_dirload_with_stat closely
Edward Thomson b3f6cef0 2015-04-28T11:16:42 dirload: loop conditional; less path mangling
Edward Thomson e05531dd 2015-04-27T18:02:06 win32 dirload: don't heap allocate DIR structure
Edward Thomson f3c444b8 2015-04-27T17:47:51 win32: abstract file attributes -> struct stat fn
J Wyman 1920ee4e 2015-03-26T18:10:24 Improvements to status performance on Windows. Changed win32/path_w32.c to utilize NTFS' FindFirst..FindNext data instead of doing an lstat per file. Avoiding unnecessary directory opens and file scans reduces IO, improving overall performance. Effect is magnified due to NTFS being a kernel mode file system (as opposed to user mode).
Jeff Hostetler 06c985d8 2015-04-18T09:07:48 Rename routine to free TLS data
Jeff Hostetler 55c5f756 2015-04-17T09:30:22 Attempt to fix Windows TLS memory leak.
Edward Thomson 523526e5 2015-03-18T18:25:14 win32 resource: allow custom comments field in DLL
Matti Virolainen 78c34af0 2015-03-06T12:23:14 Use secure API if available.
Tony Kelman 04c5a9c0 2015-03-05T19:42:54 Add some missing definitions for mingw.org these shouldn't be necessary if _WIN32_WINNT >= _WIN32_WINNT_VISTA
Tony Kelman 1a7ea63d 2015-03-05T17:11:17 Move definitions of strcasecmp and strncasecmp to msvc-compat.h should cut down on compiler warnings with mingw
Carlos Martín Nieto bdf0e734 2015-03-04T14:55:56 Merge pull request #2932 from jeffhostetler/jeffhostetler/big_clone_crash Fix crash in git_clone on extremely large repos
Jeff Hostetler d8be5087 2015-03-03T13:35:10 Change ifdef for MINGW32.
Jeff Hostetler 7e9b21aa 2015-02-27T08:54:48 Fix p_ftruncate to handle big files for git_clone
Edward Thomson bf1476f1 2015-03-02T10:35:26 win32: add the patch level to the .dll fileversion Win32 DLLs have four fields for the version number (major, minor, teeny, patch). If a consumer wants to build a custom DLL, it may be useful to set the patchlevel version number in the DLL. This value only affects the DLL version number, it does not affect the resultant "version number", which remains major.minor.teeny.
Carlos Martín Nieto a7fa970f 2015-02-15T05:13:50 Merge pull request #2895 from ethomson/alloc_overflow allocations: test for overflow of requested size
Edward Thomson f1453c59 2015-02-12T12:19:37 Make our overflow check look more like gcc/clang's Make our overflow checking look more like gcc and clang's, so that we can substitute it out with the compiler instrinsics on platforms that support it. This means dropping the ability to pass `NULL` as an out parameter. As a result, the macros also get updated to reflect this as well.
Edward Thomson 527ed59a 2015-02-13T09:18:49 win32: limit the mode to `_wopen`/`_waccess` Win32 generally ignores Unix-like mode bits that don't make any sense on the platform (eg `0644` makes no sense to Windows). But WINE complains loudly when presented with POSIXy bits. Remove them. (Thanks @phkelley)
Edward Thomson 2884cc42 2015-02-11T09:39:38 overflow checking: don't make callers set oom Have the ALLOC_OVERFLOW testing macros also simply set_oom in the case where a computation would overflow, so that callers don't need to.
Edward Thomson 3603cb09 2015-02-10T23:13:49 git__*allocarray: safer realloc and malloc Introduce git__reallocarray that checks the product of the number of elements and element size for overflow before allocation. Also introduce git__mallocarray that behaves like calloc, but without the `c`. (It does not zero memory, for those truly worried about every cycle.)
Edward Thomson 392702ee 2015-02-09T23:41:13 allocations: test for overflow of requested size Introduce some helper macros to test integer overflow from arithmetic and set error message appropriately.
Edward Thomson 3c68bfcd 2015-02-04T18:24:31 stat: don't remove trailing '/' from root on win32 `p_stat` calls `git_win32_path_from_utf8`, which canonicalizes the path. Do not further try to modify the path, else we trim the trailing slash from a root directory and try to access `C:` instead of `C:/`.
Jacques Germishuys a1daec3c 2014-12-29T18:11:33 Undef stat first
Carlos Martín Nieto 629417bd 2014-12-19T08:08:47 Fix ming32 compilation We need to know what wchar_t and MAX_PATH are. Including common.h takes care of that for us.
Edward Thomson a64119e3 2014-11-25T18:13:00 checkout: disallow bad paths on win32 Disallow: 1. paths with trailing dot 2. paths with trailing space 3. paths with trailing colon 4. paths that are 8.3 short names of .git folders ("GIT~1") 5. paths that are reserved path names (COM1, LPT1, etc). 6. paths with reserved DOS characters (colons, asterisks, etc) These paths would (without \\?\ syntax) be elided to other paths - for example, ".git." would be written as ".git". As a result, writing these paths literally (using \\?\ syntax) makes them hard to operate with from the shell, Windows Explorer or other tools. Disallow these.
Edward Thomson cceae9a2 2014-12-01T13:09:58 win32: use NT-prefixed "\\?\" paths When turning UTF-8 paths into UCS-2 paths for Windows, always use the \\?\-prefixed paths. Because this bypasses the system's path canonicalization, handle the canonicalization functions ourselves. We must: 1. always use a backslash as a directory separator 2. only use a single backslash between directories 3. not rely on the system to translate "." and ".." in paths 4. remove trailing backslashes, except at the drive root (C:\)
Carlos Martín Nieto 177a29d8 2014-10-27T10:39:45 Merge commit 'refs/pull/2366/head' of github.com:libgit2/libgit2
Edward Thomson 8d45b469 2014-10-11T14:34:24 p_lstat win32: don't canonicalize volume mounts A reparse point that is an IO_REPARSE_TAG_MOUNT_POINT could be a junction or an actual filesystem mount point. (Who knew?) If it's the latter, its reparse point will report the actual volume information \??\Volume{GUID}\ and we should not attempt to dereference that further, instead readlink should report EINVAL since it's not a symlink / junction and its original path was canonical. Yes, really.
Jacques Germishuys 07d03d31 2014-07-13T16:40:51 Introduce some consistency in definition/declaration ordering
Jacques Germishuys c983604e 2014-07-12T14:44:21 Consistently use p_snprintf
Jacques Germishuys 2f795d8f 2014-07-12T14:45:56 Cleanup portability/compatibility layer * Removes mingw-compat.h * Cleans up separation of compiler/platform idiosyncrasies * Unifies mingw/msvc stat structures and functions * (Tries to) hide more compiler specific implementation details (even in our internal API)
Jacques Germishuys 59ceb432 2014-07-05T21:27:47 Define IO_REPARSE_TAG_SYMLINK if its not defined by WinNT.h
Jacques Germishuys 72090514 2014-07-05T21:27:21 Secure CRT is only available from Visual Studio 2005+
Jacques Germishuys cde32d4d 2014-07-05T21:25:55 Variadic macros is only available from Visual Studio 2005+
Jacques Germishuys ab864e9c 2014-07-05T21:25:20 _stat64 is a function, __stat64 is the structure
Carlos Martín Nieto 461da57a 2014-06-23T17:32:30 Merge remote-tracking branch 'upstream/cmn/filebuf-atomic-unlock'
Philip Kelley 1b4e29b7 2014-06-07T13:56:39 React to review feedback
Philip Kelley fb591767 2014-06-07T12:51:48 Win32: Fix object::cache::threadmania test on x64
Carlos Martín Nieto e58281aa 2014-04-04T14:40:38 filebuf: make unlocking atomic When renaming a lock file to its final location, we need to make sure that it is replaced atomically. We currently have a workaround for Windows by removing the target file. This means that the target file, which may be a ref or a packfile, may cease to exist for a short wile, which shold be avoided. Implement the workaround only in Windows, by making sure that the file we want to replace is writable.
Albert Meltzer 62e562f9 2014-05-18T07:54:41 Fix compiler warning (git_off_t cast to size_t). Use size_t for page size, instead of long. Check result of sysconf. Use size_t for page offset so no cast to size_t (second arg to p_mmap). Use mod instead div/mult pair, so no cast to size_t is necessary.
Vicent Marti 138af337 2014-05-19T12:20:31 Merge pull request #2303 from jacquesg/mingw-lseek WIP: Windows fixes
Carlos Martín Nieto 0731a5b4 2014-05-14T19:12:48 indexer: mmap fixes for Windows Windows has its own ftruncate() called _chsize_s(). p_mkstemp() is changed to use p_open() so we can make sure we open for writing; the addition of exclusive create is a good thing to do regardless, as we want a temporary path for ourselves. Lastly, MSVC doesn't quite know how to add two numbers if one of them is a void pointer, so let's alias it to unsigned char.C
Carlos Martín Nieto f7310540 2014-05-13T02:41:48 indexer: use mmap for writing Some OSs cannot keep their ideas about file content straight when mixing standard IO with file mapping. As we use mmap for reading from the packfile, let's make writing to the pack file use mmap.
Philip Kelley f0b820dd 2014-05-16T12:38:56 Win32: Supply _O_NOINHERIT when calling _wopen
Jacques Germishuys 1017f81f 2014-04-27T13:44:06 Undef lseek first
Philip Kelley 7110000d 2014-04-22T10:21:19 React to feedback for UTF-8 <-> WCHAR and reparse work
Edward Thomson 65477db1 2014-04-21T23:32:31 Handle win32 reparse points properly
Philip Kelley c2c81615 2014-04-19T18:05:31 Win32: UTF-8 <-> WCHAR conversion overhaul
Jan Melcher 2873a862 2014-03-27T12:42:44 Retry renaming files on Access Denied errors When a file is open for reading (without shared-delete permission), and then a different thread/process called p_rename, that would fail, even if the file was only open for reading for a few milliseconds. This change lets p_rename wait up to 50ms for the file to be closed by the reader. Applies only to win32. This is especially important for git_filebuf_commit, because writes should not fail if the file is read simultaneously. Fixes #2207
Edward Thomson 55d257e7 2014-02-05T15:03:00 Remove unused utf8 -> utf16 conversion code
Russell Belfer 7697e541 2013-12-11T15:02:20 Test cancel from indexer progress callback This adds tests that try canceling an indexer operation from within the progress callback. After writing the tests, I wanted to run this under valgrind and had a number of errors in that situation because mmap wasn't working. I added a CMake option to force emulation of mmap and consolidated the Amiga-specific code into that new place (so we don't actually need separate Amiga code now, just have to turn on -DNO_MMAP). Additionally, I made the indexer code propagate error codes more reliably than it used to.
Edward Thomson 5588f073 2013-12-09T10:25:36 Clean up warnings
Alessandro Ghedini 758f2f10 2013-11-27T14:17:40 posix: Solaris doesn't have strnlen either
Russell Belfer 14997dc5 2013-10-08T12:45:43 More filemode cleanups for FAT on MacOS This cleans up some additional issues. The main change is that on a filesystem that doesn't support mode bits, libgit2 will now create new blobs with GIT_FILEMODE_BLOB always instead of being at the mercy to the filesystem driver to report executable or not. This means that if "core.filemode" lies and claims that filemode is not supported, then we will ignore the executable bit from the filesystem. Previously we would have allowed it. This adds an option to the new git_repository_reset_filesystem to recurse through submodules if desired. There may be other types of APIs that would like a "recurse submodules" option, but this one is particularly useful. This also has a number of cleanups, etc., for related things including trying to give better error messages when problems come up from the filesystem. For example, the FAT filesystem driver on MacOS appears to return errno EINVAL if you attempt to write a filename with invalid UTF-8 in it. We try to capture that with a better error message now.
Vicent Martí 3d4f1698 2013-09-17T10:21:22 Merge pull request #1858 from linquize/win32-template-dir Configurable template dir for Win32
Russell Belfer eefc32d5 2013-09-16T12:54:40 Bug fixes and cleanups This contains a few bug fixes and some header and API cleanups. The main API change is that filters should now use GIT_PASSTHROUGH to indicate that they wish to skip processing a file instead of GIT_ENOTFOUND. The bug fixes include a possible out-of-range buffer access in the ident filter, a filter ordering problem I introduced into the custom filter tests on Windows, and a filter buf NUL termination issue that was coming up on Linux.
Russell Belfer a3aa5f4d 2013-09-11T12:45:20 Add simple global shutdown hooks Increasingly there are a number of components that want to do some cleanup at global shutdown time (at least if there are not going to be memory leaks). This creates a very simple system of shutdown hooks that will be invoked by git_threads_shutdown. Right now, the maximum number of hooks is hardcoded, but since adding a hook is not a public API, it should be fine and I thought it was better to start off with really simple code.
Linquize f84bc388 2013-09-17T23:24:44 Refactor git_win32__find_system_dirs() to extract "etc\\" as subpath parameter
Linquize 89095fbd 2013-09-17T22:57:30 Fix failure in win32_find_git_in_registry() when UAC is turned on Demand read only access to registry key instead of full access. This might happen in Windows Vista and later.
Linquize ffbd337a 2013-09-17T22:57:06 Fix failure in win32_find_git_in_registry() The buffer size 0 was definitely not enough so it failed
Linquize 21753d48 2013-09-05T20:42:47 Fix warning in src/win32/version.h