summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
| * | tests: config: verify that the global config is actually readablePatrick Steinhardt2019-03-291-0/+12
| | | | | | | | | | | | | | | | | | | | | While we do verify that we are able to open the global ".gitconfig" file in config::global::open_global, we never verify that we it is in fact readable. Do so by writing the global configuration file and verifying that reading from it produces the expected values.
| * | tests: repo: verify that we can open repos with symlinked global configPatrick Steinhardt2019-03-291-0/+30
| | | | | | | | | | | | | | | | | | We've got reports that users are unable to open repos when their global configuration ("~/.gitconfig") is a symlink. Add a test to verify that we are in fact able to do so as expected.
| * | tests: config: make sure to clean up after each testPatrick Steinhardt2019-03-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | The config::global test suite creates various different directories and files which are being populated with pretend-global files. Unfortunately, the tests do not clean up after themselves, which may cause subsequent tests to fail due to cruft left behind. Fix this by always removing created directories and their contents.
* | | Merge pull request #5035 from pks-t/pks/diff-with-space-in-filenamesEdward Thomson2019-04-042-0/+27
|\ \ \ | | | | | | | | patch_parse: fix parsing addition/deletion of file with space
| * | | tests: diff: test parsing diffs with a new file with spaces in its pathErik Aigner2019-03-292-0/+27
| |/ / | | | | | | | | | | | | Add a test that verifies that we are able to parse patches which add a new file that has spaces in its path.
* | | ignore: move tests from status to attr ignore suiteSteven King Jr2019-03-202-40/+25
| | |
* | | ignore: add additional test casesSteven King Jr2019-03-151-3/+5
| | |
* | | ignore: Do not match on prefix of negated patternsSteve King Jr2019-03-141-3/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Matching on the prefix of a negated pattern was triggering false negatives on siblings of that pattern. e.g. Given the .gitignore: dir/* !dir/sub1/sub2/** The path `dir/a.text` would not be ignored.
* | | Implement failing test for gitignore of complex subdirectory negationTyler Ang-Wanek2019-03-141-0/+18
|/ / | | | | | | When a directory's contents are ignored, and then a glob negation is made to a nested subdir, other subdirectories are now unignored
* | Merge pull request #5000 from augfab/branch_lookup_allEdward Thomson2019-02-251-2/+25
|\ \ | | | | | | Have git_branch_lookup accept GIT_BRANCH_ALL
| * | branch: add test for git_branch_lookup to accept GIT_BRANCH_ALLAugustin Fabre2019-02-221-2/+25
| | |
* | | indexer: use git_indexer_progress throughoutEdward Thomson2019-02-226-19/+19
| | | | | | | | | | | | | | | Update internal usage of `git_transfer_progress` to `git_indexer_progreses`.
* | | Merge pull request #4901 from pks-t/pks/uniform-map-apiEdward Thomson2019-02-223-100/+211
|\ \ \ | | | | | | | | High-level map APIs
| * | | oidmap: remove legacy low-level interfacePatrick Steinhardt2019-02-151-163/+62
| | | | | | | | | | | | | | | | | | | | | | | | Remove the low-level interface that was exposing implementation details of `git_oidmap` to callers. From now on, only the high-level functions shall be used to retrieve or modify values of a map. Adjust remaining existing callers.
| * | | strmap: remove legacy low-level interfacePatrick Steinhardt2019-02-151-30/+15
| | | | | | | | | | | | | | | | | | | | | | | | Remove the low-level interface that was exposing implementation details of `git_strmap` to callers. From now on, only the high-level functions shall be used to retrieve or modify values of a map. Adjust remaining existing callers.
| * | | maps: provide high-level iteration interfacePatrick Steinhardt2019-02-152-3/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, our headers need to leak some implementation details of maps due to their direct use of indices in the implementation of their foreach macros. This makes it impossible to completely hide the map structures away, and also makes it impossible to include the khash implementation header in the C files of the respective map only. This is now being fixed by providing a high-level iteration interface `map_iterate`, which takes as inputs the map that shall be iterated over, an iterator as well as the locations where keys and values shall be put into. For simplicity's sake, the iterator is a simple `size_t` that shall initialized to `0` on the first call. All existing foreach macros are then adjusted to make use of this new function.
| * | | oidmap: introduce high-level setter for key/value pairsPatrick Steinhardt2019-02-151-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, one would use either `git_oidmap_insert` to insert key/value pairs into a map or `git_oidmap_put` to insert a key only. These function have historically been macros, which is why their syntax is kind of weird: instead of returning an error code directly, they instead have to be passed a pointer to where the return value shall be stored. This does not match libgit2's common idiom of directly returning error codes.Furthermore, `git_oidmap_put` is tightly coupled with implementation details of the map as it exposes the index of inserted entries. Introduce a new function `git_oidmap_set`, which takes as parameters the map, key and value and directly returns an error code. Convert all trivial callers of `git_oidmap_insert` and `git_oidmap_put` to make use of it.
| * | | oidmap: introduce high-level getter for valuesPatrick Steinhardt2019-02-151-0/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current way of looking up an entry from a map is tightly coupled with the map implementation, as one first has to look up the index of the key and then retrieve the associated value by using the index. As a caller, you usually do not care about any indices at all, though, so this is more complicated than really necessary. Furthermore, it invites for errors to happen if the correct error checking sequence is not being followed. Introduce a new high-level function `git_oidmap_get` that takes a map and a key and returns a pointer to the associated value if such a key exists. Otherwise, a `NULL` pointer is returned. Adjust all callers that can trivially be converted.
| * | | strmap: introduce high-level setter for key/value pairsPatrick Steinhardt2019-02-151-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, one would use the function `git_strmap_insert` to insert key/value pairs into a map. This function has historically been a macro, which is why its syntax is kind of weird: instead of returning an error code directly, it instead has to be passed a pointer to where the return value shall be stored. This does not match libgit2's common idiom of directly returning error codes. Introduce a new function `git_strmap_set`, which takes as parameters the map, key and value and directly returns an error code. Convert all callers of `git_strmap_insert` to make use of it.
| * | | strmap: introduce `git_strmap_get` and use it throughout the treePatrick Steinhardt2019-02-151-1/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current way of looking up an entry from a map is tightly coupled with the map implementation, as one first has to look up the index of the key and then retrieve the associated value by using the index. As a caller, you usually do not care about any indices at all, though, so this is more complicated than really necessary. Furthermore, it invites for errors to happen if the correct error checking sequence is not being followed. Introduce a new high-level function `git_strmap_get` that takes a map and a key and returns a pointer to the associated value if such a key exists. Otherwise, a `NULL` pointer is returned. Adjust all callers that can trivially be converted.
| * | | maps: provide a uniform entry count interfacePatrick Steinhardt2019-02-152-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There currently exist two different function names for getting the entry count of maps, where offmaps offset and string maps use `num_entries` and OID maps use `size`. In most programming languages with built-in map types, this is simply called `size`, which is also shorter to type. Thus, this commit renames the other two functions `num_entries` to match the common way and adjusts all callers.
| * | | maps: use uniform lifecycle management functionsPatrick Steinhardt2019-02-152-5/+3
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the lifecycle functions for maps (allocation, deallocation, resize) are not named in a uniform way and do not have a uniform function signature. Rename the functions to fix that, and stick to libgit2's naming scheme of saying `git_foo_new`. This results in the following new interface for allocation: - `int git_<t>map_new(git_<t>map **out)` to allocate a new map, returning an error code if we ran out of memory - `void git_<t>map_free(git_<t>map *map)` to free a map - `void git_<t>map_clear(git<t>map *map)` to remove all entries from a map This commit also fixes all existing callers.
* | | Merge pull request #4996 from eaigner/masterPatrick Steinhardt2019-02-211-0/+33
|\ \ \ | | | | | | | | Prevent reading out of bounds memory
| * | | tests: apply: verify that we correctly truncate the source bufferPatrick Steinhardt2019-02-211-0/+33
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | Previously, we would fail to correctly truncate the source buffer if the source has more than one line and ends with a non-newline character. In the following call, we thus truncate the source string in the middle of the second line. Without the bug fixed, we would successfully apply the patch to the source and return success. With the overflow being fixed, we should return an error now.
* | | Fix a memory leak in odb_otype_fast()lhchavez2019-02-201-0/+21
| |/ |/| | | | | This change frees a copy of a cached object in odb_otype_fast().
* | Merge pull request #4982 from pks-t/pks/worktree-add-bare-headEdward Thomson2019-02-142-2/+55
|\ \ | | | | | | Enable creation of worktree from bare repo's default branch
| * | branch: fix `branch_is_checked_out` with bare reposPatrick Steinhardt2019-02-141-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a bare repository, HEAD usually points to the branch that is considered the "default" branch. As the current implementation for `git_branch_is_checked_out` only does a comparison of HEAD with the branch that is to be checked, it will say that the branch pointed to by HEAD in such a bare repo is checked out. Fix this by skipping the main repo's HEAD when it is bare.
| * | branches: introduce flag to skip enumeration of certain HEADsPatrick Steinhardt2019-02-141-2/+2
| | | | | | | | | | | | | | | | | | | | | Right now, the function `git_repository_foreach_head` will always iterate over all HEADs of the main repository and its worktrees. In some cases, it might be required to skip either of those, though. Add a flag in preparation for the following commit that enables this behaviour.
| * | branches: do not assert that the given ref is a branchPatrick Steinhardt2019-02-141-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Libraries should use assert(3P) only very scarcely. First, we usually shouldn't cause the caller of our library to abort in case where the assert fails. Second, if code is compiled with -DNDEBUG, then the assert will not be included at all. In our `git_branch_is_checked_out` function, we have an assert that verifies that the given reference parameter is non-NULL and in fact a branch. While the first check is fine, the second is not. E.g. when compiled with -DNDEBUG, we'd proceed and treat the given reference as a branch in all cases. Fix the issue by instead treating a non-branch reference as not being checked out. This is the obvious solution, as references other than branches cannot be directly checked out.
| * | branches: add tests for `git_branch_is_checked_out`Patrick Steinhardt2019-02-141-0/+39
| |/ | | | | | | | | We currently do not have any tests at all for the `git_branch_is_checked_out` function. Add some basic ones.
* | Merge pull request #4965 from hackworks/eliminate-check-for-keep-fileEdward Thomson2019-02-141-0/+10
|\ \ | | | | | | Allow bypassing check for '.keep' file
| * | Allow bypassing check '.keep' files using libgit2 option ↵Dhruva Krishnamurthy2019-02-021-0/+10
| |/ | | | | | | 'GIT_OPT_IGNORE_PACK_KEEP_FILE_CHECK'
* | deprecation: ensure we GIT_EXTERN deprecated funcsEdward Thomson2019-02-141-0/+3
|/ | | | | | | | | | Although the error functions were deprecated, we did not properly mark them as deprecated. We need to include the `deprecated.h` file in order to ensure that the functions get their export attributes. Similarly, do not define `GIT_DEPRECATE_HARD` within the library, or those functions will also not get their export attributes. Define that only on the tests and examples.
* test: cast to a char the zstream testEdward Thomson2019-01-251-1/+1
|
* index test: cast times explicitlyEdward Thomson2019-01-251-2/+2
| | | | Cast actual filesystem data to the int32_t that index entries store.
* Merge pull request #4858 from tiennou/fix/index-ext-readEdward Thomson2019-01-258-0/+36
|\ | | | | index: preserve extension parsing errors
| * index: preserve extension parsing errorsEtienne Samson2019-01-248-0/+36
| | | | | | | | | | | | | | Previously, we would clobber any extension-specific error message with an "extension is truncated" message. This makes `read_extension` correctly preserve those errors, takes responsibility for truncation errors, and adds a new message with the actual extension signature for unsupported mandatory extensions.
* | deprecation: define GIT_DEPRECATE_HARD internallyEdward Thomson2019-01-251-0/+2
| | | | | | | | | | Ensure that we do not use any deprecated functions in the library source, test code or examples.
* | deprecation: move deprecated tests into their own fileEdward Thomson2019-01-252-36/+60
|/ | | | | | Move the deprecated stream tests into their own compilation unit. This will allow us to disable any preprocessor directives that apply to deprecation just for these tests (eg, disabling `GIT_DEPRECATED_HARD`).
* git_error: use new names in internal APIs and usageEdward Thomson2019-01-2243-184/+184
| | | | | Move to the `git_error` name in the internal API for error-related functions.
* Fix odb foreach to also close on positive error codeMarijan Šuflaj2019-01-201-0/+15
| | | | | | | | In include/git2/odb.h it states that callback can also return positive value which should break looping. Implementations of git_odb_foreach() and pack_backend__foreach() did not respect that.
* Merge pull request #4939 from libgit2/ethomson/git_refEdward Thomson2019-01-1914-160/+160
|\ | | | | Move `git_ref_t` to `git_reference_t`
| * references: use new names in internal usageethomson/git_refEdward Thomson2019-01-1714-160/+160
| | | | | | | | Update internal usage to use the `git_reference` names for constants.
* | Merge pull request #4940 from libgit2/ethomson/git_objEdward Thomson2019-01-192-7/+7
|\ \ | | | | | | More `git_obj` to `git_object` updates
| * | object_type: GIT_OBJECT_BAD is now GIT_OBJECT_INVALIDEdward Thomson2019-01-172-7/+7
| |/ | | | | | | | | | | | | We use the term "invalid" to refer to bad or malformed data, eg `GIT_REF_INVALID` and `GIT_EINVALIDSPEC`. Since we're changing the names of the `git_object_t`s in this release, update it to be `GIT_OBJECT_INVALID` instead of `BAD`.
* | Merge pull request #4943 from libgit2/ethomson/ciEdward Thomson2019-01-192-2/+3
|\ \ | | | | | | ci: only run invasive tests in nightly
| * | ci: precisely identify the invasive testsEdward Thomson2019-01-191-1/+1
| | |
| * | tests: fix test expectation mismatchEtienne Samson2019-01-141-2/+2
| | |
| * | ci: enable some of the invasive testcasesEtienne Samson2019-01-111-0/+1
| | |
* | | Merge pull request #4925 from lhchavez/fix-a-bunch-of-warningsEdward Thomson2019-01-175-8/+10
|\ \ \ | |_|/ |/| | Fix a bunch of warnings