summaryrefslogtreecommitdiff
path: root/tests/refs/branches
Commit message (Collapse)AuthorAgeFilesLines
* Fix one memory leak in masterlhchavez2021-07-301-0/+2
| | | | There was one test that wasn't correctly disposing of the repository.
* tests: reformat upstream mergeEdward Thomson2021-07-301-5/+5
|
* tests: upstream merge test has been added.Dmitry Lobanov2021-06-181-0/+23
|
* Add git_branch_name_is_validSven Strickroth2020-10-251-0/+17
| | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* fileops: rename to "futils.h" to match function signaturesPatrick Steinhardt2019-07-201-1/+1
| | | | | | | | | Our file utils functions all have a "futils" prefix, e.g. `git_futils_touch`. One would thus naturally guess that their definitions and implementation would live in files "futils.h" and "futils.c", respectively, but in fact they live in "fileops.h". Rename the files to match expectations.
* 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-223-10/+10
| | | | | 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-171-1/+1
| | | | 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-011-2/+2
|/ | | | Use the new object_type enumeration names within the codebase.
* Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-104-4/+4
|
* tests: gather the reflog entry content testsEtienne Samson2017-11-152-80/+0
|
* tests: update error message checkingethomson/error_msgsEdward Thomson2016-12-291-1/+1
|
* 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.
* refdb: delete a ref's reflog upon deletioncmn/reflog-del-backendCarlos Martín Nieto2015-07-121-0/+2
| | | | | | Removing a reflog upon ref deletion is something which only some backends might wish to do. Backends which are database-backed may wish to archive a reflog, log-based ones may not need to do anything.
* branch: error out if we cannot find the remotecmn/upstream-matching-pushCarlos Martín Nieto2015-05-221-0/+32
| | | | | | | | | | | When we look for which remote corresponds to a remote-tracking branch, we look in the refspecs to see which ones matches. If none do, we should abort. We currently ignore the error message from this operation, so let's not do that anymore. As part of the test we're writing, let's test for the expected behaviour if we cannot find a refspec which tells us what the remote-tracking branch for a remote would look like.
* remote: remove live changing of refspecsCarlos Martín Nieto2015-05-131-6/+1
| | | | | | | | | | | | The base refspecs changing can be a cause of confusion as to what is the current base refspec set and complicate saving the remote's configuration. Change `git_remote_add_{fetch,push}()` to update the configuration instead of an instance. This finally makes `git_remote_save()` a no-op, it will be removed in a later commit.
* Add tests for the annotated versions of ref-modifying functionsCarlos Martín Nieto2015-03-161-0/+16
| | | | | This also brings the soft-reset tests back to life. The function name was missing an underscore, meaning they had not been running.
* refdb: use the same id for old and new when renaming a referencecmn/rename-reflogCarlos Martín Nieto2015-03-081-0/+4
| | | | | | | | | When we rename a reference, we want the old and new ids to be the same one (as we did not change it). The normal code path looks up the old id from the current value of the brtanch, but by the time we look it up, it does not exist anymore and thus we write a zero id. Pass the old id explicitly instead.
* branch: fix generated reflog message upon renamingnulltoken2015-03-041-1/+1
|
* branch: fix generated reflog message upon creationnulltoken2015-03-041-1/+1
|
* config: borrow refcounted referencescmn/config-borrow-entryCarlos Martín Nieto2015-03-032-36/+37
| | | | | | | | | | | | | | | This changes the get_entry() method to return a refcounted version of the config entry, which you have to free when you're done. This allows us to avoid freeing the memory in which the entry is stored on a refresh, which may happen at any time for a live config. For this reason, get_string() has been forbidden on live configs and a new function get_string_buf() has been added, which stores the string in a git_buf which the user then owns. The functions which parse the string value takea advantage of the borrowing to parse safely and then release the entry.
* repository: remove log message override for switching the active branchCarlos Martín Nieto2015-03-031-1/+1
| | | | | | We want to use the "checkout: moving from ..." message in order to let git know when a change of branch has happened. Make the convenience functions for this goal write this message.
* branch: don't accept a reflog message overrideCarlos Martín Nieto2015-03-033-72/+32
| | | | | | | This namespace is about behaving like git's branch command, so let's do exactly that instead of taking a reflog message. This override is still available via the reference namespace.
* Remove the signature from ref-modifying functionsCarlos Martín Nieto2015-03-036-39/+37
| | | | | | | | | | The signature for the reflog is not something which changes dynamically. Almost all uses will be NULL, since we want for the repository's default identity to be used, making it noise. In order to allow for changing the identity, we instead provide git_repository_set_ident() and git_repository_ident() which allow a user to override the choice of signature.
* Fix branch creation when branch name matches namespace of previously deleted ↵Jeff Hostetler2015-02-031-0/+104
| | | | branch
* branch: consider an empty upstream remote config as not foundCarlos Martín Nieto2014-11-171-0/+16
|
* branch: add getter for the upstream remote nameCarlos Martín Nieto2014-11-081-0/+9
| | | | This gets the value from branch.<foo>.remote.
* Refs: Extend unicode test for branch creation.Arthur Schreiber2014-05-301-0/+3
| | | | | | This adds another assertion to ensure that the reference name inside the git_reference struct returned by `git_branch_create` is returned as precomposed if `core.precomposeunicode` is enabled.
* Refs: Add a unicode test for git_branch_move.Arthur Schreiber2014-05-301-0/+17
| | | | | This tests that decomposed branch names are correctly precomposed when passed to `git_branch_move` and `core.precomposeunicode` is enabled.
* Don't always test composed-insensitive lookupsrb/unicode-branch-namesRussell Belfer2014-05-081-4/+4
| | | | | | Only on a filesystem that is composed/decomposed insensitive, should be testing that a branch can be looked up by the opposite form and still work correctly.
* Pass unconverted data when iconv doesn't like itRussell Belfer2014-05-081-0/+56
| | | | | | | | | | | | | | When using Iconv to convert unicode data and iconv doesn't like the source data (because it thinks that it's not actual UTF-8), instead of stopping the operation, just use the unconverted data. This will generally do the right thing on the filesystem, since that is the source of the non-UTF-8 path data anyhow. This adds some tests for creating and looking up branches with messy Unicode names. Also, this takes the helper function that was previously internal to `git_repository_init` and makes it into `git_path_does_fs_decompose_unicode` which is a useful in tests to understand what the expected results should be.
* Some further sandboxing cleanups to testsRussell Belfer2014-05-023-32/+8
| | | | | Trying to find other issues where tests may not clean up quite properly when they are through...
* Add GIT_BRANCH_ALL to git_branch_t enumSven Strickroth2014-04-161-2/+2
| | | | | | | | git_branch_t is an enum so requesting GIT_BRANCH_LOCAL | GIT_BRANCH_REMOTE is not possible as it is not a member of the enum (at least VS2013 C++ complains about it). This fixes a regression introduced in commit a667ca8298193b3103c1dbdcb1f6c527e6e99eb2 (PR #1946). Signed-off-by: Sven Strickroth <email@cs-ware.de>
* Merge pull request #2144 from linquize/branch-f-currentBen Straub2014-03-021-0/+19
|\ | | | | Do not allow git_branch_create() to force update branch
| * Add unit test to show git_branch_create() fails if attempt to force create ↵Linquize2014-03-021-0/+19
| | | | | | | | current branch
* | Add reflog params to git_repository_detach_headBen Straub2014-02-041-1/+1
| |
* | Reset helpers: use revparse insteadBen Straub2014-02-031-4/+5
|/
* Allow tests to run without user configBen Straub2014-01-302-0/+12
|
* Enhance testing of signature parametersBen Straub2014-01-302-3/+22
|
* Provide good default reflog messages in branch apiBen Straub2014-01-302-0/+38
|
* Ensure moving a branch updates the reflogBen Straub2014-01-301-0/+19
|
* Add reflog parameters to git_branch_moveBen Straub2014-01-301-13/+13
|
* Deleting a branch deletes its reflogBen Straub2014-01-302-20/+26
|
* Add reflog params to git_branch_createBen Straub2014-01-302-10/+14
|
* Add passing reflog testsBen Straub2014-01-301-1/+29
|