summaryrefslogtreecommitdiff
path: root/tests/refs
Commit message (Collapse)AuthorAgeFilesLines
* refs: loosen restriction on wildcard "*" refspecsPatrick Steinhardt2019-04-261-6/+6
| | | | | | | | | | | | In commit cd377f45c9 (refs: loosen restriction on wildcard "*" refspecs, 2015-07-22) in git.git, the restrictions on wildcard "*" refspecs has been loosened. While wildcards were previously only allowed if the component is a single "*", this was changed to also accept other patterns as part of the component. We never adapted to that change and still reject any wildcard patterns that aren't a single "*" only. Update our tests to reflect the upstream change and adjust our own code accordingly.
* branch: add test for git_branch_lookup to accept GIT_BRANCH_ALLAugustin Fabre2019-02-221-2/+25
|
* 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: 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.
* git_error: use new names in internal APIs and usageEdward Thomson2019-01-225-13/+13
| | | | | Move to the `git_error` name in the internal API for error-related functions.
* references: use new names in internal usageethomson/git_refEdward Thomson2019-01-178-150/+150
| | | | Update internal usage to use the `git_reference` names for constants.
* Merge pull request #4833 from csware/drop-empty-dirsPatrick Steinhardt2018-12-191-0/+46
|\ | | | | Remove empty (sub-)directories when deleting refs
| * Remove empty directories when deleting refsSven Strickroth2018-10-131-0/+46
| | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | object_type: use new enumeration namesethomson/index_fixesEdward Thomson2018-12-014-50/+50
| | | | | | | | Use the new object_type enumeration names within the codebase.
* | refs: add support for core.logAllRefUpdates=alwaysEtienne Samson2018-11-181-0/+22
|/ | | | | | | Since we were not expecting this config entry to contain a string, we would fail as soon as its (cached) value would be accessed. Hence, provide some constants for the 4 states we use, and account for "always" when we decide to reflog changes.
* treewide: remove use of C++ style commentsPatrick Steinhardt2018-07-138-36/+37
| | | | | | | | | 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.
* Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-1013-26/+26
|
* refdb_fs: add test for globbing of nonexistant refsJulian Ganz2018-06-011-0/+5
|
* tests: refs::normalize: simplify code to avoid GCC warningPatrick Steinhardt2018-05-041-4/+1
| | | | | | | | Since version 8.1, GCC will do some automatic bounds checking when printing static content into a buffer with known size. The bounds checking doesn't yet work quite right in all scenarios and may thus lead to false positives. Fix one of these false positives in refs::normalize by simplifying the code.
* refs: preserve the owning refdb when duping referenceEtienne Samson2018-04-101-0/+2
| | | This fixes a segfault in git_reference_owner on references returned from git_reference__read_head and git_reference_dup ones.
* testrepo: add new branchEdward Thomson2018-02-231-2/+2
| | | | | | Add a new branch to the `testrepo` repository, where the `README` file has changed to executable. This branch enables typechange tests between the new `executable` branch and `master`.
* tests: refs::iterator: fix memory leak due to ref names not being free'dPatrick Steinhardt2018-01-121-0/+1
| | | | | | | The test refs::iterator::foreach_name iterates through every reference and copies its name into a local vector. While the test makes sure to free the vector afterwards, the copied reference names are not being free'd. Fix that.
* refs:iterator: add tests to recurse symlinksethomson/branch_symlinksEdward Thomson2017-12-301-18/+66
| | | | Ensure that we can recurse into directories via symbolic links.
* tests: move free functions at the endEtienne Samson2017-11-221-16/+17
|
* tests: move static method to the topEtienne Samson2017-11-151-12/+12
|
* tests: make reflog_check_entry more clar-yEtienne Samson2017-11-153-37/+75
|
* tests: clarify which steps corresponds to each checksEtienne Samson2017-11-151-5/+5
|
* tests: gather the reflog entry content testsEtienne Samson2017-11-159-240/+498
|
* refs: do not use peeled OID if peeling to a tagPatrick Steinhardt2017-10-061-0/+12
| | | | | | | | | | | | | | | | | | | | | | If a reference stored in a packed-refs file does not directly point to a commit, tree or blob, the packed-refs file will also will include a fully-peeled OID pointing to the first underlying object of that type. If we try to peel a reference to an object, we will use that peeled OID to speed up resolving the object. As a reference for an annotated tag does not directly point to a commit, tree or blob but instead to the tag object, the packed-refs file will have an accomodating fully-peeled OID pointing to the object referenced by that tag. When we use the fully-peeled OID pointing to the referenced object when peeling, we obviously cannot peel that to the tag anymore. Fix this issue by not using the fully-peeled OID whenever we want to peel to a tag. Note that this does not include the case where we want to resolve to _any_ object type. Existing code may make use from the fact that we resolve those to commit objects instead of tag objects, even though that behaviour is inconsistent between packed and loose references. Furthermore, some tests of ours make the assumption that we in fact resolve those references to a commit.
* tests: refs::crashes: create sandbox for creating symrefPatrick Steinhardt2017-06-231-2/+2
| | | | | | | | | The test `refs::crashes::double_free` operates on our in-source "testrepo.git" repository without creating a copy first. As the test will try to create a new symbolic reference, this will fail when we want to do a pure out-of-tree build with a read-only source tree. Fix the issue by creating a sandbox first.
* settings: rename `GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION`Patrick Steinhardt2017-06-081-2/+2
| | | | | | | | | | | Initially, the setting has been solely used to enable the use of `fsync()` when creating objects. Since then, the use has been extended to also cover references and index files. As the option is not yet part of any release, we can still correct this by renaming the option to something more sensible, indicating not only correlation to objects. This commit renames the option to `GIT_OPT_ENABLE_FSYNC_GITDIR`. We also move the variable from the object to repository source code.
* revparse: support open-ended rangesWilliam Bain2017-05-051-0/+35
| | | | | | | Support '..' and '...' ranges where one side is not specified. The unspecified side defaults to HEAD. Closes #4223
* Merge pull request #4030 from libgit2/ethomson/fsyncEdward Thomson2017-03-221-0/+68
|\ | | | | fsync all the things
| * Honor `core.fsyncObjectFiles`ethomson/fsyncEdward Thomson2017-03-021-26/+41
| |
| * win32: don't fsync parent directories on WindowsEdward Thomson2017-02-281-2/+13
| | | | | | | | Windows doesn't support it.
| * fsync: call it "synchronous" object writingEdward Thomson2017-02-281-2/+2
| | | | | | | | | | Rename `GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION` -> `GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION`.
| * fsync parent directories when fsyncingEdward Thomson2017-02-281-2/+2
| | | | | | | | | | | | When fsync'ing files, fsync the parent directory in the case where we rename a file into place, or create a new file, to ensure that the directory entry is flushed correctly.
| * refdb_fs: optionally fsync packed refsEdward Thomson2017-02-281-0/+15
| |
| * refdb_fs: optionally fsync loose referencesEdward Thomson2017-02-281-0/+27
| |
* | refs::namespace: add namespace testsEdward Thomson2017-03-061-0/+36
| | | | | | | | | | These simple tests only ensure that we enforce the existence of a namespace; these mirror the rugged tests, they are not exhaustive.
* | tests: refs::create: fix memory leakPatrick Steinhardt2017-03-011-1/+1
| |
* | Merge pull request #4143 from richardipsum/issue-4094Patrick Steinhardt2017-03-011-1/+43
|\ \ | |/ |/| Fix: make reflog include "(merge)" for merge commits
| * Add test for inclusion of (merge) in reflogRichard Ipsum2017-02-281-1/+43
| | | | | | | | | | This test ensures that the string '(merge)' is included in the reflog when a merge commit is made.
* | Whitespace and style fixesRichard Ipsum2017-02-251-5/+5
| | | | | | | | | | Use C style comments as per style guide, and fix mismatching indentation.
* | tests: Add create__symbolic_with_arbitrary_contentRichard Ipsum2017-02-251-0/+49
|/ | | | | | | This test ensures that it's possible to create a symbolic ref that has arbitrary data as its target. It also ensures it's possible to obtain the target of that symbolic reference from the git_reference object.
* tests: add merge-conflict branch for testrepoPatrick Steinhardt2017-02-131-2/+2
| | | | | Add a new branch that causes a merge conflict to `testrepo` so that we are able to test merging in worktrees.
* tests: add worktree test dataPatrick Steinhardt2017-02-131-2/+2
|
* tests: update error message checkingethomson/error_msgsEdward Thomson2016-12-292-2/+2
|
* branch: fix forced branch creation on HEAD of a bare repoJohn Fultz2016-11-041-1/+25
| | | | | | | | | | | | | The code correctly detects that forced creation of a branch on a nonbare repo should not be able to overwrite a branch which is the HEAD reference. But there's no reason to prevent this on a bare repo, and in fact, git allows this. I.e., git branch -f master new_sha works on a bare repo with HEAD set to master. This change fixes that problem, and updates tests so that, for this case, both the bare and nonbare cases are checked for correct behavior.
* Allow creating copies of `git_reference` objects.Arthur Schreiber2016-04-221-0/+40
|
* Merge pull request #3736 from libgit2/cmn/dwim-general-messageEdward Thomson2016-04-111-0/+8
|\ | | | | refs: provide a more general error message for dwim
| * refs: provide a more general error message for dwimcmn/dwim-general-messageCarlos Martín Nieto2016-04-111-0/+8
| | | | | | | | | | | | | | 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.
* | refs::create: strict object creation on by defaultEdward Thomson2016-04-111-5/+5
|/ | | | | | | | 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.
* tests: plug a leakCarlos Martín Nieto2016-03-031-0/+1
|