tests


Log

Author Commit Date CI Message
Edward Thomson 5a9d850e 2016-08-05T19:30:56 odb: only provide the empty tree Only provide the empty tree internally, which matches git's behavior. If we provide the empty blob then any users trying to write it with libgit2 would omit it from actually landing in the odb, which appear to git proper as a broken repository (missing that object).
Edward Thomson ed5299ac 2016-08-05T20:34:19 odb: actually insert the empty blob in tests
Stefan Huber e499b13c 2016-08-24T01:20:39 git_checkout_tree options fix According to the reference the git_checkout_tree and git_checkout_head functions should accept NULL in the opts field This was broken since the opts field was dereferenced and thus lead to a crash.
Patrick Steinhardt 0dea4299 2016-08-12T09:06:15 ignore: allow unignoring basenames in subdirectories The .gitignore file allows for patterns which unignore previous ignore patterns. When unignoring a previous pattern, there are basically three cases how this is matched when no globbing is used: 1. when a previous file has been ignored, it can be unignored by using its exact name, e.g. foo/bar !foo/bar 2. when a file in a subdirectory has been ignored, it can be unignored by using its basename, e.g. foo/bar !bar 3. when all files with a basename are ignored, a specific file can be unignored again by specifying its path in a subdirectory, e.g. bar !foo/bar The first problem in libgit2 is that we did not correctly treat the second case. While we verified that the negative pattern matches the tail of the positive one, we did not verify if it only matches the basename of the positive pattern. So e.g. we would have also negated a pattern like foo/fruz_bar !bar Furthermore, we did not check for the third case, where a basename is being unignored in a certain subdirectory again. Both issues are fixed with this commit.
Patrick Steinhardt 85addddf 2016-08-04T13:45:28 refspec: do not set empty rhs for fetch refspecs According to git-fetch(1), "[t]he colon can be omitted when <dst> is empty." So according to git, the refspec "refs/heads/master" is the same as the refspec "refs/heads/master:" when fetching changes. When trying to fetch from a remote with a trailing colon with libgit2, though, the fetch actually fails while it works when the trailing colon is left out. So obviously, libgit2 does _not_ treat these two refspec formats the same for fetches. The problem results from parsing refspecs, where the resulting refspec has its destination set to an empty string in the case of a trailing colon and to a `NULL` pointer in the case of no trailing colon. When passing this to our DWIM machinery, the empty string gets translated to "refs/heads/", which is simply wrong. Fix the problem by having the parsing machinery treat both cases the same for fetch refspecs.
Krishna Ram Prakash R 1edbfa1f 2016-06-28T20:19:52 Fixed bug while parsing INT64_MIN
Josh Triplett a200dc9e 2016-04-03T19:24:15 Fix repository discovery with ceiling_dirs at current directory git only checks ceiling directories when its search ascends to a parent directory. A ceiling directory matching the starting directory will not prevent git from finding a repository in the starting directory or a parent directory. libgit2 handled the former case correctly, but differed from git in the latter case: given a ceiling directory matching the starting directory, but no repository at the starting directory, libgit2 would stop the search at that point rather than finding a repository in a parent directory. Test case using git command-line tools: /tmp$ git init x Initialized empty Git repository in /tmp/x/.git/ /tmp$ cd x/ /tmp/x$ mkdir subdir /tmp/x$ cd subdir/ /tmp/x/subdir$ GIT_CEILING_DIRECTORIES=/tmp/x git rev-parse --git-dir fatal: Not a git repository (or any of the parent directories): .git /tmp/x/subdir$ GIT_CEILING_DIRECTORIES=/tmp/x/subdir git rev-parse --git-dir /tmp/x/.git Fix the testsuite to test this case (in one case fixing a test that depended on the current behavior), and then fix find_repo to handle this case correctly. In the process, simplify and document the logic in find_repo(): - Separate the concepts of "currently checking a .git directory" and "number of iterations left before going further counts as a search" into two separate variables, in_dot_git and min_iterations. - Move the logic to handle in_dot_git and append /.git to the top of the loop. - Only search ceiling_dirs and find ceiling_offset after running out of min_iterations; since ceiling_offset only tracks the longest matching ceiling directory, if ceiling_dirs contained both the current directory and a parent directory, this change makes find_repo stop the search at the parent directory.
Patrick Steinhardt fc2b97dd 2016-06-20T17:44:04 threads: split up OS-dependent thread code
Edward Thomson ac44d354 2016-06-15T15:47:28 checkout: use empty baseline when no index When no index file exists and a baseline is not explicitly provided, use an empty baseline instead of trying to load `HEAD`.
Patrick Steinhardt 6e0d473b 2016-06-07T12:29:16 tests: fix memory leaks in checkout::typechange
Edward Thomson 8be49681 2016-06-01T22:31:16 test: ensure we can round-trip a written tree Read a tree into an index, write the index, then re-open the index and ensure that we are treesame to the original.
Edward Thomson 6c133a75 2016-06-01T14:52:25 round-trip trees through index_read_index Read a tree into an index using `git_index_read_index` (by reading a tree into a new index, then reading that index into the current index), then write the index back out, ensuring that our new index is treesame to the tree that we read.
Edward Thomson bcef008f 2016-05-26T10:51:16 cleanup: unused warning
Jason Haslam 70681ff7 2016-02-16T21:02:41 checkout: handle dirty submodules correctly Don't generate conflicts when checking out a modified submodule and the submodule is dirty or modified in the workdir.
François Revol 26917fd9 2016-05-24T19:07:09 test: Fix stat() test to mask out unwanted bits Haiku and Hurd both pass extra bits in struct stat::st_mode.
Carlos Martín Nieto 16541b86 2016-04-25T12:16:05 tag: ignore extra header fields While no extra header fields are defined for tags, git accepts them by ignoring them and continuing the search for the message. There are a few tags like this in the wild which git parses just fine, so we should do the same.
Edward Thomson 8edadbf9 2016-03-07T17:37:17 index::racy: force racy entry Instead of hoping that we can get a racy entry by going real fast and praying real hard, just create a racy entry.
Edward Thomson 6a35e74c 2016-03-30T17:47:05 leaks: fix some leaks in the tests
Carlos Martín Nieto 2c1bc36d 2016-03-29T14:47:31 Plug a few leaks
Edward Thomson 5cc7a5c7 2016-04-11T13:39:31 tests: skip the unreadable file tests as root When running as root, skip the unreadable file tests, because, well, they're probably _not_ unreadable to root unless you've got some crazy NSA clearance-level honoring operating system shit going on.
Edward Thomson 1d59c85a 2016-03-17T00:47:50 status: update test to include valid OID
Edward Thomson af753aba 2016-03-22T00:18:44 tree: drop the now-unnecessary entries vector Remove the now-unnecessary entries vector. Add `git_array_search` to binary search through an array to accomplish this.
Carlos Martín Nieto 26f2cefb 2016-03-20T11:00:12 tree: re-use the id and filename in the odb object Instead of copying over the data into the individual entries, point to the originals, which are already in a format we can use.
Carlos Martín Nieto 17789083 2016-04-01T14:33:42 ignore: don't use realpath to canonicalize path If we're looking for a symlink, realpath will give us the resolved path, which is not what we're after, but a canonicalized version of the path the user asked for.
Edward Thomson 21d8832e 2016-03-28T08:56:13 config::write::repeated: init our buffer
Carlos Martín Nieto e8d5df9e 2016-03-04T14:51:16 config: show we write a spurious duplicated section header We should notice that we are in the correct section to add. This is a cosmetic bug, since replacing any of these settings does work.
Edward Thomson b6130fe1 2016-04-11T11:50:11 refs::create: strict object creation on by default When we turned strict object creation validation on by default, we forgot to inform the refs::create tests of this. They, in fact, believed that strict object creation was off by default. As a result, their cleanup function went and turned strict object creation off for the remaining tests.
Carlos Martín Nieto ba52879b 2016-04-11T11:37:02 reset: use real ids for the tests This lets us run with strict object creation on.
Carlos Martín Nieto 3e2e8240 2016-04-11T17:43:07 refs: provide a more general error message for dwim If we cannot dwim the input, set the error message to be explicit about that. Otherwise we leave the error for the last failed lookup, which can be rather unexpected as it mentions a remote when the user thought they were trying to look up a branch.
Andreas Henriksson ab062a39 2016-04-06T10:37:30 tests: fix core/stream test when built with openssl off When passing -DUSE_OPENSSL:BOOL=OFF to cmake the testsuite will fail with the following error: core::stream::register_tls [/tmp/libgit2/tests/core/stream.c:40] Function call failed: (error) error -1 - <no message> Fix test to assume failure for tls when built without openssl. While at it also fix GIT_WIN32 cpp to check if it's defined or not.
Carlos Martín Nieto c86a65be 2016-03-21T21:10:26 config: don't special-case multivars that don't exist yet This special-casing ignores that we might have a locked file, so the hashtable does not represent the contents of the file we want to write. This causes multivar writes to overwrite entries instead of add to them when under lock. There is no need for this as the normal code-path will write to the file just fine, so simply get rid of it.
Carlos Martín Nieto e97d2d70 2016-03-17T10:45:22 commit: fix extraction of single-line signatures The function to extract signatures suffers from a similar bug to the header field finding one by having an unecessary line feed check as a break condition of its loop. Fix that and add a test for this single-line signature situation.
Dirkjan Bussink cdde081b 2016-03-14T12:41:41 Use general cl_git_fail because the error is generic
Dirkjan Bussink c1ec732f 2016-03-14T12:02:00 Setup better defaults for OpenSSL ciphers This ensures that when using OpenSSL a safe default set of ciphers is selected. This is done so that the client communicates securely and we don't accidentally enable unsafe ciphers like RC4, or even worse some old export ciphers. Implements the first part of https://github.com/libgit2/libgit2/issues/3682
Patrick Steinhardt faf823dc 2016-03-11T09:58:38 tests: transport: fix memory leaks with registering transports
Chris Bargren b8dc15f7 2015-12-28T11:35:19 Adding test cases that actually test the functionality of the new transport ssh, ssh+git and git+ssh should all successfully build an SSH transport
Chris Bargren fa8b1a88 2015-12-22T10:56:38 Adding spec coverage for ssh+git and git+ssh protocols
Carlos Martín Nieto ea5bf6bb 2016-03-04T12:34:38 treebuilder: don't try to verify submodules exist in the odb Submodules don't exist in the objectdb and the code is making us try to look for a blob with its commit id, which is obviously not going to work. Skip the test if the user wants to insert a submodule.
Carlos Martín Nieto e23efa6d 2016-03-03T21:03:10 tests: take the version from our define
Carlos Martín Nieto 9b3fc895 2016-03-03T11:17:36 tests: plug a leak
Edward Thomson f2dddf52 2016-02-28T15:51:38 turn on strict object validation by default
Edward Thomson 4afe536b 2016-02-28T16:02:49 tests: use legitimate object ids Use legitimate (existing) object IDs in tests so that we have the ability to turn on strict object validation when running tests.
Edward Thomson 98c34149 2016-02-28T15:11:15 refs: honor strict object creation
Edward Thomson 6ddf533a 2016-02-23T18:29:16 git_index_add: validate objects in index entries (optionally) When `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION` is turned on, validate the index entries given to `git_index_add`.
Edward Thomson 2bbc7d3e 2016-02-23T15:00:27 treebuilder: validate tree entries (optionally) When `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION` is turned on, validate the tree and parent ids given to treebuilder insertion.
Edward Thomson ef63bab3 2016-02-23T13:34:35 git_commit: validate tree and parent ids When `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION` is turned on, validate the tree and parent ids given to commit creation functions.
Edward Thomson 6cc4bac8 2016-02-28T11:31:10 Merge pull request #3577 from rossdylan/rossdylan/pooldebug Add a new build flag to disable the pool allocator
Edward Thomson a4c55069 2016-02-25T11:31:18 nsec: update staging test for GIT_USE_NSECS The index::nsec::staging_maintains_other_nanos test was created to ensure that when we stage an entry when GIT_USE_NSECS is *unset* that we truncate the index entry and do not persist the (old, invalid) nanosec values. Ensure that when GIT_USE_NSECS is *set* that we do not do that, and actually write the correct nanosecond values.
Edward Thomson 7bab2e8f 2016-02-22T23:04:40 git_libgit2_opts: validate key
Carlos Martín Nieto 5663d4f6 2016-02-18T12:31:56 Merge pull request #3613 from ethomson/fixups Remove most of the silly warnings
Carlos Martín Nieto 594a5d12 2016-02-18T12:28:06 Merge pull request #3619 from ethomson/win32_forbidden win32: allow us to read indexes with forbidden paths on win32
Edward Thomson 318b825e 2016-02-16T17:11:46 index: allow read of index w/ illegal entries Allow `git_index_read` to handle reading existing indexes with illegal entries. Allow the low-level `git_index_add` to add properly formed `git_index_entry`s even if they contain paths that would be illegal for the current filesystem (eg, `AUX`). Continue to disallow `git_index_add_bypath` from adding entries that are illegal universally illegal (eg, `.git`, `foo/../bar`).
Edward Thomson 4be2aa57 2016-02-16T18:50:08 win32: tests around handling forbidden paths Introduce a repository that contains some paths that were illegal on PC-DOS circa 1981 (like `aux`, `con`, `com1`) and that in a bizarre fit of retrocomputing, remain illegal on some "modern" computers, despite being "new technology". Introduce some aspirational tests that suggest that we should be able to cope with trees and indexes that contain paths that would be illegal on the filesystem, so that we can at least diff them. Further ensure that checkout will not write a repository with forbidden paths.
Carlos Martín Nieto eadd0f05 2016-02-16T14:06:48 commit: expose the different kinds of errors We should be checking whether the object we're looking up is a commit, and we should let the caller know whether the not-found return code comes from a bad object type or just a missing signature.
Edward Thomson 0d9a39ea 2016-02-12T10:02:18 win32: drop incorrect `const`ness
Edward Thomson f28bae0c 2016-02-15T17:16:00 rebase: persist a single in-memory index When performing an in-memory rebase, keep a single index for the duration, so that callers have the expected index lifecycle and do not hold on to an index that is free'd out from under them.
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.
Carlos Martín Nieto 5a296ad0 2016-02-12T00:55:20 Merge pull request #3610 from ethomson/rebase_bare rebase: introduce bare rebasing
Arthur Schreiber 3679ebae 2016-02-11T23:37:52 Horrible fix for #3173.
Carlos Martín Nieto 460ae11f 2016-02-11T22:19:20 commit: don't forget the last header field When we moved the logic to handle the first one, wrong loop logic was kept in place which meant we still finished early. But we now notice it because we're not reading past the last LF we find. This was not noticed before as the last field in the tested commit was multi-line which does not trigger the early break.
Edward Thomson 263e674e 2016-02-11T11:41:23 merge tests: correct casts
Edward Thomson ad8aa112 2016-02-11T11:26:42 reset test: fix initialization warning
Edward Thomson a202e0d4 2016-02-11T10:11:21 rebase: allow custom merge_options Allow callers of rebase to specify custom merge options. This may allow custom conflict resolution, or failing fast when conflicts are detected.
Edward Thomson ee667307 2016-02-11T10:48:48 rebase: introduce inmemory rebasing Introduce the ability to rebase in-memory or in a bare repository. When `rebase_options.inmemory` is specified, the resultant `git_rebase` session will not be persisted to disk. Callers may still analyze the rebase operations, resolve any conflicts against the in-memory index and create the commits. Neither `HEAD` nor the working directory will be updated during this process.
Vicent Marti 488e2b85 2016-02-09T16:26:58 Merge pull request #3599 from libgit2/gpgsign Introduce git_commit_extract_signature
Carlos Martín Nieto a65afb75 2016-02-08T18:51:13 Introduce git_commit_extract_signature This returns the GPG signature for a commit and its contents without the signature block, allowing for the verification of the commit's signature.
Carlos Martín Nieto f55eca16 2016-02-09T07:17:26 commit: also match the first header field when searching We were searching only past the first header field, which meant we were unable to find e.g. `tree` which is the first field. While here, make sure to set an error message in case we cannot find the field.
Ross Delinger ed0571f8 2016-01-12T16:08:38 Add a new build flag to disable the pool allocator and pass all git_pool_malloc calls straight to git__malloc
Edward Thomson 62602547 2015-12-26T22:39:22 git_repository_init: include dotfiles when copying templates Include dotfiles when copying template directory, which will handle both a template directory itself that begins with a dotfile, and any dotfiles inside the directory.
Edward Thomson 00282183 2015-12-26T22:32:17 repo::init tests: test a template dir with leading dot Ensure that we can handle template directories that begin with a leading dot.
Edward Thomson 5c042c5b 2015-12-26T22:06:45 repo::init tests: test init.templatedir setting Ensure that `git_repository_init` honors the `init.templatedir` configuration setting.
Dmitriy Olshevskiy 91f0d186 2015-12-21T20:49:14 typos in comments
Vicent Marti 5951445f 2015-12-17T10:13:04 commit: Fix memory leak in test suite
Edward Thomson 30c8e260 2015-12-14T13:53:26 Merge pull request #3521 from pks-t/blame-line-overflow Line count overflow in git_blame_hunk and git_blame__entry
Carlos Martín Nieto 6aa06b65 2015-12-10T12:14:09 Merge pull request #3522 from pks-t/email-format-commit-message diff: include commit message when formatting patch
Carlos Martín Nieto 465c3b38 2015-12-09T19:16:11 reset: perform the checkout before moving HEAD or the index This keeps the state of the workdir the same as one from HEAD, removing a source of possible confusion when calculating the work that is to be done.
Michał Górny 326c9fc2 2015-12-01T20:41:23 checkout test: Apply umask to file-mode test as well Fix the file-mode test to expect system umask being applied to the created file as well (it is currently applied to the directory only). This fixes the test on systems where umask != 022. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Patrick Steinhardt 254e0a33 2015-11-24T13:43:43 diff: include commit message when formatting patch When formatting a patch as email we do not include the commit's message in the formatted patch output. Implement this and add a test that verifies behavior.
Patrick Steinhardt 7f8fe1d4 2015-12-01T10:03:56 commit: introduce `git_commit_body` It is already possible to get a commit's summary with the `git_commit_summary` function. It is not possible to get the remaining part of the commit message, that is the commit message's body. Fix this by introducing a new function `git_commit_body`.
Patrick Steinhardt cb1cb24c 2015-11-24T10:18:58 blame: use size_t for line counts in git_blame_hunk It is not unreasonable to have versioned files with a line count exceeding 2^16. Upon blaming such files we fail to correctly keep track of the lines as `git_blame_hunk` stores them in `uint16_t` fields. Fix this by converting the line fields of `git_blame_hunk` to `size_t`. Add test to verify behavior.
Patrick Steinhardt a7bd157e 2015-11-30T17:40:49 tests: fix warning for nested struct initialization
Carlos Martín Nieto a27f31d8 2015-11-30T04:49:31 Merge pull request #3513 from ethomson/merge_recursive Recursive Merge
Edward Thomson 5b9c63c3 2015-11-20T19:01:42 recursive merge: add a recursion limit
Edward Thomson 78859c63 2015-11-20T17:33:49 merge: handle conflicts in recursive base building When building a recursive merge base, allow conflicts to occur. Use the file (with conflict markers) as the common ancestor. The user has already seen and dealt with this conflict by virtue of having a criss-cross merge. If they resolved this conflict identically in both branches, then there will be no conflict in the result. This is the best case scenario. If they did not resolve the conflict identically in the two branches, then we will generate a new conflict. If the user is simply using standard conflict output then the results will be fairly sensible. But if the user is using a mergetool or using diff3 output, then the common ancestor will be a conflict file (itself with diff3 output, haha!). This is quite terrible, but it matches git's behavior.
Edward Thomson 34a51428 2015-11-09T11:55:26 merge tests: add complex recursive example
Edward Thomson 651bfd69 2015-11-09T08:24:47 recursive: test conflict output during recursive merge
Edward Thomson dcde5720 2015-11-09T08:23:27 merge tests: move expected data into own file
Edward Thomson b1eef912 2015-10-27T18:00:30 merge: add recursive test with conflicting contents
Edward Thomson fccad82e 2015-10-27T14:23:35 merge: add recursive test with three merge bases
Edward Thomson 99d9d9a4 2015-10-26T17:44:36 merge: improve test names in recursive merge tests
Edward Thomson a200bcf7 2015-10-26T17:25:42 merge: add a third-level recursive merge
Edward Thomson cdb6c1c8 2015-10-26T17:14:28 merge: add a second-level recursive merge
Edward Thomson 86c8d02c 2015-10-22T20:20:07 merge: add simple recursive test Add a simple recursive test - where multiple ancestors exist and creating a virtual merge base from them would prevent a conflict.
Edward Thomson fa78782f 2015-10-22T17:00:09 merge: rename `git_merge_tree_flags_t` -> `git_merge_flags_t`
Patrick Steinhardt 77b79dde 2015-11-24T14:36:46 tests: win32::longpath: free expected_msg
Patrick Steinhardt 9031be18 2015-11-24T14:38:17 tests: config::stress: free `git_config` structs
Patrick Steinhardt c8fab201 2015-11-24T14:29:32 tests: config::global: fix memleak in open_programdata
Edward Thomson c4f60543 2015-11-20T17:57:04 Merge pull request #3517 from jacquesg/warnings-fixes Fix some warnings
Jacques Germishuys 87428c55 2015-11-20T20:48:51 Fix some warnings
Carlos Martín Nieto 2ea40fda 2015-11-20T13:19:23 repository: distinguish sequencer cherry-pick and revert These are not quite like their plain counterparts and require special handling.