summaryrefslogtreecommitdiff
path: root/tests/core
Commit message (Collapse)AuthorAgeFilesLines
* Plug some leaksCarlos Martín Nieto2015-09-271-0/+2
|
* mkdir: find component paths for mkdir_relativeEdward Thomson2015-09-171-7/+8
| | | | | | | | | | | | `git_futils_mkdir` does not blindly call `git_futils_mkdir_relative`. `git_futils_mkdir_relative` is used when you have some base directory and want to create some path inside of it, potentially removing blocking symlinks and files in the process. This is not suitable for a general recursive mkdir within the filesystem. Instead, when `mkdir` is being recursive, locate the first existent parent directory and use that as the base for `mkdir_relative`.
* core::mkdir tests: ensure we don't stomp symlinks in mkdirEdward Thomson2015-09-171-0/+34
| | | | | In `mkdir` and `mkdir_r`, ensure that we don't try to remove symlinks that are in our way.
* core::mkdir tests: include absolute mkdirsEdward Thomson2015-09-171-0/+35
|
* git_futils_mkdir_*: make a relative-to-base mkdirEdward Thomson2015-09-174-33/+33
| | | | | | | | | | | | Untangle git_futils_mkdir from git_futils_mkdir_ext - the latter assumes that we own everything beneath the base, as if it were being called with a base of the repository or working directory, and is tailored towards checkout and ensuring that there is no bogosity beneath the base that must be cleaned up. This is (at best) slow and (at worst) unsafe in the larger context of a filesystem where we do not own things and cannot do things like unlink symlinks that are in our way.
* diriter: test we can iterate rootEdward Thomson2015-09-131-0/+29
| | | | | | Ensure that we can iterate the filesystem root and that paths come back well-formed, not with an additional '/'. (eg, when iterating `c:/`, expect that we do not get some path like `c://autoexec.bat`).
* futils: ensure we can write a hidden fileEdward Thomson2015-09-081-0/+68
|
* filebuf: ensure we can lock a hidden fileEdward Thomson2015-09-081-0/+26
|
* filebuf: follow symlinks when creating a lock filecmn/follow-symlinkCarlos Martín Nieto2015-09-051-0/+53
| | | | | | | We create a lockfile to update files under GIT_DIR. Sometimes these files are actually located elsewhere and a symlink takes their place. In that case we should lock and update the file at its final location rather than overwrite the symlink.
* errors: tighten up git_error_state OOMs a bit moreEdward Thomson2015-08-031-5/+28
| | | | | When an error state is an OOM, make sure that we treat is specially and do not try to free it.
* Test: check restored oom error points to static bufferMichael Procter2015-08-031-4/+4
|
* Add failing test for capture/restore oom errorMichael Procter2015-08-031-0/+23
|
* filebuf: remove lockfile upon rename errorscmn/filebuf-rename-errorCarlos Martín Nieto2015-07-241-1/+1
| | | | | | | | | | When we have an error renaming the lockfile, we need to make sure that we remove it upon cleanup. For this, we need to keep track of whether we opened the file and whether the rename succeeded. If we did create the lockfile but the rename did not succeed, we remove the lockfile. This won't protect against all errors, but the most common ones (target file is open) does get handled.
* filebuf: failing test for leaving the lockfile when failing to renameCarlos Martín Nieto2015-07-241-0/+27
| | | | | When we fail to rename, we currently leave the lockfile laying around. This shows that behaviour.
* git__getenv: utf-8 aware env readerEdward Thomson2015-07-022-13/+9
| | | | | | 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).
* buffer: make use of EINVALID for growing a borrowed bufferCarlos Martín Nieto2015-06-241-1/+1
| | | | | This explains more closely what happens. While here, set an error message.
* buffer: don't allow growing borrowed buffersCarlos Martín Nieto2015-06-241-0/+13
| | | | | | | | | | When we don't own a buffer (asize=0) we currently allow the usage of grow to copy the memory into a buffer we do own. This muddles the meaning of grow, and lets us be a bit cavalier with ownership semantics. Don't allow this any more. Usage of grow should be restricted to buffers which we know own their own memory. If unsure, we must not attempt to modify it.
* git_buf_text_lf_to_crlf: allow mixed line endingsEdward Thomson2015-06-221-8/+31
| | | | | Allow files to have mixed line endings instead of skipping processing on them.
* Merge pull request #3219 from libgit2/cmn/racy-diffCarlos Martín Nieto2015-06-171-0/+49
|\ | | | | Zero out racily-clean entries' file_size
| * Introduce p_utimes and p_futimesEdward Thomson2015-06-161-0/+49
| | | | | | | | | | | | Provide functionality to set the time on a filesystem entry, using utimes or futimes on POSIX type systems or SetFileTime on Win32.
* | Fixed Xcode 6.1 build warningsPierre-Olivier Latour2015-06-151-3/+3
|/
* Merge pull request #3165 from ethomson/downcaseCarlos Martín Nieto2015-06-081-0/+42
|\ | | | | Downcase
| * git__tolower: test that some non-ASCII downcasing isn'tEdward Thomson2015-05-291-0/+4
| |
| * git__strcasecmp: treat input bytes as unsignedEdward Thomson2015-05-291-0/+38
| | | | | | | | | | | | Treat input bytes as unsigned before doing arithmetic on them, lest we look at some non-ASCII byte (like a UTF-8 character) as a negative value and perform the comparison incorrectly.
* | Fixed build warnings on Xcode 6.1Pierre-Olivier Latour2015-06-021-1/+1
|/
* stash_apply: provide its own options structureEdward Thomson2015-05-111-0/+5
|
* git_path_diriter: next shouldn't take path ptrEdward Thomson2015-05-011-9/+50
| | | | | | | | The _next method shouldn't take a path pointer (and a path_len pointer) as 100% of current users use the full path and ignore the filename. Plus let's add some docs and a unit test.
* Rename GIT_SSL to GIT_OPENSSLCarlos Martín Nieto2015-04-231-1/+1
| | | | | This is what it's meant all along, but now we actually have multiple implementations, it's clearer to use the name of the library.
* Add a SecureTransport TLS channelCarlos Martín Nieto2015-04-231-1/+1
| | | | | As an alternative to OpenSSL when we're on OS X. This one can actually take advantage of stacking the streams.
* Fix memleak in test/core/mkdir reported by CRTDBGJeff Hostetler2015-04-171-1/+1
|
* Fix p_ftruncate to handle big files for git_cloneJeff Hostetler2015-03-031-0/+48
|
* Remove extra semicolon outside of a functionStefan Widgren2015-02-152-2/+2
| | | | | Without this change, compiling with gcc and pedantic generates warning: ISO C does not allow extra ‘;’ outside of a function.
* Make our overflow check look more like gcc/clang'sEdward Thomson2015-02-131-6/+10
| | | | | | | | | 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.
* overflow checking: don't make callers set oomEdward Thomson2015-02-121-0/+21
| | | | | | 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.
* allocations: test for overflow of requested sizeEdward Thomson2015-02-121-0/+40
| | | | | Introduce some helper macros to test integer overflow from arithmetic and set error message appropriately.
* stat: don't remove trailing '/' from root on win32Edward Thomson2015-02-051-0/+17
| | | | | | | `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:/`.
* structinit test: use %PRIuZ instead of %d for size_tEdward Thomson2015-02-041-1/+1
|
* structinit test: only run on DEBUG buildsEdward Thomson2015-01-211-0/+163
| | | | | | | The structinit tests don't make sense unless structure padding is uniformly initialized, which is unlikely to happen on release builds. Only enable them for DEBUG builds. Further, rename them to core::structinit.
* Make binary detection work similar to vanilla gitSven Strickroth2015-01-201-1/+1
| | | | | | Main change: Don't treat chars > 128 as non-printable (common in UTF-8 files) Signed-off-by: Sven Strickroth <email@cs-ware.de>
* win32: use NT-prefixed "\\?\" pathsEdward Thomson2014-12-161-16/+3
| | | | | | | | | | | | 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:\)
* core::link test: clean up junction point nameEdward Thomson2014-12-091-7/+50
|
* init: return the number of initializationsEdward Thomson2014-12-041-0/+14
|
* buffer: Do not `put` anything if len is 0Vicent Marti2014-11-211-3/+2
|
* hashsig: Export as a `sys` headervmg/hashsigVicent Marti2014-10-011-1/+1
|
* path: Fix `git_path_walk_up` to work with non-rooted pathsThe rugged tests are fragile2014-09-171-15/+38
|
* Allow mkdir helper to skip parent errorsrb/mkdir-allow-parent-failuresRussell Belfer2014-08-221-0/+31
| | | | | | | Our mkdir helper was failing is a parent directory was not accessible even if the child directory could be created. This changes the helper to keep trying child directories even when the parent is unwritable.
* Introduce git_buf_decode_base64Edward Thomson2014-08-151-8/+29
| | | | Decode base64-encoded text into a git_buf
* Round up pool alloc sizes for alignmentrb/round-up-pool-allocationsRussell Belfer2014-06-301-5/+5
| | | | | | | | | | | | | To make sure that items returned from pool allocations are aligned on nice boundaries, this rounds up all pool allocation sizes to a multiple of 8. This adds a small amount of overhead to each item. The rounding up could be made optional with an extra parameter to the pool initialization that turned on rounding only for pools where item alignment actually matters, but I think for the extra code and complexity that would be involved, that it makes sense just to burn a little bit of extra memory and enable this all the time.
* crlf: pass-through mixed EOL buffers from LF->CRLFcmn/mixed-eol-passthroughCarlos Martín Nieto2014-06-231-18/+8
| | | | | | | | | | When checking out files, we're performing conversion into the user's native line endings, but we only want to do it for files which have consistent line endings. Refuse to perform the conversion for mixed-EOL files. The CRLF->LF filter is left as-is, as that conversion is considered to be normalization by git and should force a conversion of the line endings.
* fileops: allow linking files when copying directory structuresCarlos Martín Nieto2014-05-281-0/+26
| | | | | When passed the LINK_FILES flag, the recursive copy will hardlink files instead of copying them.