summaryrefslogtreecommitdiff
path: root/tests/t10-refs.c
Commit message (Collapse)AuthorAgeFilesLines
* Removing test suites that have been ported to Clar:Ben Straub2012-03-311-1338/+0
| | | | | | | | | | | | | | | | | * t00 / 6e86fb3 (mentioned in #406) * t01 / fc60c4a (mentioned in #406) * t03 / bcbabe6 * t04 / PR #606 * t05 / d96f2c3 * t06 / 6c106ee * t07 / 2ef582b * t08 / b482c42 * t09 / 9a39a36 * t10 / 00a4893 * t12 / 7c3a4a7 * t13 / 1cb9b31 * t17 / cdaa6ff (mentioned in #406) * t18 / efabc08
* Rename git_oid_to_string to git_oid_tostrAuthmillenon2012-03-061-4/+4
| | | | | To conform the naming scheme of git_oid_fromstr we should change the name of git_oid_to_string to git_oid_tostr.
* Move path related functions from fileops to pathRussell Belfer2012-01-171-10/+10
| | | | | | | | | | | This takes all of the functions that look up simple data about paths (such as `git_futils_isdir`) and moves them over to path.h (becoming `git_path_isdir`). This leaves fileops.h just with functions that actually manipulate the filesystem or look at the file contents in some way. As part of this, the dir.h header which is really just for win32 support was moved into win32 (with some minor changes).
* Use git_buf for path storage instead of stack-based buffersRussell Belfer2011-12-071-35/+45
| | | | | | | | | | | | | | | | | | | | This converts virtually all of the places that allocate GIT_PATH_MAX buffers on the stack for manipulating paths to use git_buf objects instead. The patch is pretty careful not to touch the public API for libgit2, so there are a few places that still use GIT_PATH_MAX. This extends and changes some details of the git_buf implementation to add a couple of extra functions and to make error handling easier. This includes serious alterations to all the path.c functions, and several of the fileops.c ones, too. Also, there are a number of new functions that parallel existing ones except that use a git_buf instead of a stack-based buffer (such as git_config_find_global_r that exists alongsize git_config_find_global). This also modifies the win32 version of p_realpath to allocate whatever buffer size is needed to accommodate the realpath instead of hardcoding a GIT_PATH_MAX limit, but that change needs to be tested still.
* Plug a bunch of leaksCarlos Martín Nieto2011-11-281-3/+37
|
* Rename all `_close` methodsVicent Marti2011-11-261-4/+4
| | | | | There's no difference between `_free` and `_close` semantics: keep everything with the same name to avoid confusions.
* refs: Partial rewrite for read-only refsVicent Marti2011-11-061-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | This new version of the references code is significantly faster and hopefully easier to read. External API stays the same. A new method `git_reference_reload()` has been added to force updating a memory reference from disk. In-memory references are no longer updated automagically -- this was killing us. If a reference is deleted externally and the user doesn't reload the memory object, nothing critical happens: any functions using that reference should fail gracefully (e.g. deletion, renaming, and so on). All generated references from the API are read only and must be free'd by the user. There is no reference counting and no traces of generated references are kept in the library. There is no longer an internal representation for references. There is only one reference struct `git_reference`, and symbolic/oid targets are stored inside an union. Packfile references are stored using an optimized struct with flex array for reference names. This should significantly reduce the memory cost of loading the packfile from disk.
* Free all used references in the source treeschu2011-11-061-0/+77
| | | | | | | Since references are not owned by the repository anymore we have to free them manually now. Signed-off-by: schu <schu-github@schulog.org>
* refs: add test case checking "immutable" referencesschu2011-11-061-0/+32
| | | | Signed-off-by: schu <schu-github@schulog.org>
* refs: split internal and external referencesschu2011-11-061-36/+36
| | | | | | | | | | | | | | | | | Currently libgit2 shares pointers to its internal reference cache with the user. This leads to several problems like invalidation of reference pointers when reordering the cache or manipulation of the cache from user side. Give each user its own git_reference instead of leaking the internal representation (struct reference). Add the following new API functions: * git_reference_free * git_reference_is_packed Signed-off-by: schu <schu-github@schulog.org>
* fileops/repository: create (most) directories with 0777 permissionsBrodie Rao2011-10-141-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To further match how Git behaves, this change makes most of the directories libgit2 creates in a git repo have a file mode of 0777. Specifically: - Intermediate directories created with git_futils_mkpath2file() have 0777 permissions. This affects odb_loose, reflog, and refs. - The top level folder for bare repos is created with 0777 permissions. - The top level folder for non-bare repos is created with 0755 permissions. - /objects/info/, /objects/pack/, /refs/heads/, and /refs/tags/ are created with 0777 permissions. Additionally, the following changes have been made: - fileops functions that create intermediate directories have grown a new dirmode parameter. The only exception to this is filebuf's lock_file(), which unconditionally creates intermediate directories with 0777 permissions when GIT_FILEBUF_FORCE is set. - The test runner now sets the umask to 0 before running any tests. This ensurses all file mode checks are consistent across systems. - t09-tree.c now does a directory permissions check. I've avoided adding this check to other tests that might reuse existing directories from the prefabricated test repos. Because they're checked into the repo, they have 0755 permissions. - Other assorted directories created by tests have 0777 permissions.
* fileops/posix: replace usage of "int mode" with "mode_t mode"Brodie Rao2011-10-141-1/+1
| | | | | Note: Functions exported from fileops take const mode_t, while the underlying POSIX wrappers take mode_t.
* Add test commit containing subtrees and filesnulltoken2011-10-131-2/+2
|
* commit: properly parse empty commit messagesBrodie Rao2011-10-121-1/+1
| | | | | | | | | This ensures commit->message is always non-NULL, even if the commit message is empty or consists of only a newline. One such commit can be found in the wild in the jQuery repository: https://github.com/jquery/jquery/commit/25b424134f9927a5bf0bab5cba836a0aa6c3cfc1
* refs: add additional test for reference renamingschu2011-09-201-0/+30
| | | | | Signed-off-by: nulltoken <emeric.fermas@gmail.com> Signed-off-by: schu <schu-github@schulog.org>
* reflog: assimilate reflog API to return git_oid'sschu2011-08-151-4/+10
| | | | | | | Rather than returning the OIDs out of the reflog as string return them as git_oid. Signed-off-by: schu <schu-github@schulog.org>
* signature: adjust API to return error codesschu2011-08-031-2/+2
| | | | | | | | git_signature_new() and git_signature_now() currently don't return error codes. Change the API to return error codes and not pointers to let the user handle errors properly. Signed-off-by: schu <schu-github@schulog.org>
* reflog: avoid users writing a wrong ancestor OIDschu2011-08-011-0/+29
| | | | | | | Disallow NULL as ancestor OID when writing a reflog entry for an existing reference. Signed-off-by: schu <schu-github@schulog.org>
* Free sig in reflog testCarlos Martín Nieto2011-07-131-0/+1
| | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* reflog: Fix reflog writer/readernulltoken2011-07-101-34/+49
| | | | | | - Use a space to separate oids and signature - Enforce test coverage - Make test run in a temporary folder in order not to alter the test repository
* reflog: add API to read or write a reference logschu2011-07-091-0/+62
| | | | | | | | | | | So far libgit2 didn't support reference logs (reflog). Add a new git_reflog_* API for basic reading and writing of reflogs: * git_reflog_read * git_reflog_write * git_reflog_free Signed-off-by: schu <schu-github@schulog.org>
* reference_renaming: add additional testsnulltoken2011-07-071-3/+35
| | | | | | | Add some more test checking forced reference renaming. Signed-off-by: nulltoken <emeric.fermas@gmail.com> Acked-by: schu <schu-github@schulog.org>
* reference_rename: git compliant reference renamingschu2011-07-061-2/+2
| | | | | | | | | | | | | | | | So far libgit2 didn't handle the following scenarios: * Rename of reference m -> m/m * Rename of reference n/n -> n Fixed. Since we don't write reflogs, we have to delete any old reflog for the renamed reference. Otherwise git.git will possibly fail when it finds invalid logs. Reported-by: nulltoken <emeric.fermas@gmail.com> Signed-off-by: schu <schu-github@schulog.org>
* Add test case checking renaming of a branch to a new name prefixed withschu2011-07-061-0/+32
| | | | | | | the old name succeeds, e.g. refs/heads/foo -> refs/heads/foo/bar Reported-by: nulltoken <emeric.fermas@gmail.com> Signed-off-by: schu <schu-github@schulog.org>
* fileops: CleanupVicent Marti2011-07-051-24/+24
| | | | | | | | | | | | | | | | Cleaned up the structure of the whole OS-abstraction layer. fileops.c now contains a set of utility methods for file management used by the library. These are abstractions on top of the original POSIX calls. There's a new file called `posix.c` that contains emulations/reimplementations of all the POSIX calls the library uses. These are prefixed with `p_`. There's a specific posix file for each platform (win32 and unix). All the path-related methods have been moved from `utils.c` to `path.c` and have their own prefix.
* cleanup: remove trailing spacesKirill A. Shutemov2011-07-011-5/+5
| | | | Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* refs: Remove duplicate rename methodVicent Marti2011-06-291-7/+7
| | | | `git_reference_rename` now takes a `force` flag
* Remove redundant methods from the APIVicent Marti2011-06-281-20/+20
| | | | | | | | | | | | | | | A bunch of redundant methods have been removed from the external API. - All the reference/tag creation methods with `_f` are gone. The force flag is now passed as an argument to the normal create methods. - All the different commit creation methods are gone; commit creation now always requires a `git_commit` pointer for parents and a `git_tree` pointer for tree, to ensure that corrupted commits cannot be generated. - All the different tag creation methods are gone; tag creation now always requires a `git_object` pointer to ensure that tags are not created to inexisting objects.
* refs: Do not overflow when normalizing refnamesVicent Marti2011-06-231-5/+5
|
* oid: Rename methodsVicent Marti2011-06-161-6/+6
| | | | | Yeah. Finally. Fuck the old names, this ain't POSIX and they don't make any sense at all.
* Revert "threads: Fix TLS declarations"Vicent Marti2011-06-071-18/+2
| | | | This commit uploaded an old broken test. Oops!
* Merge pull request #232 from schu/ref-available-cbVicent Martí2011-06-061-0/+33
|\ | | | | reference_rename: respect all references v2
| * Add test case checking we do not corrupt the repository when renamingschu2011-06-051-0/+33
| | | | | | | | Signed-off-by: schu <schu-github@schulog.org>
* | threads: Fix TLS declarationsVicent Marti2011-06-071-2/+18
|/ | | | | Cleanup the thread-utils file. Do not define TLS if libgit2 is not threadsafe.
* Fix tiny typoschu2011-05-291-1/+1
| | | | | Signed-off-by: nulltoken <emeric.fermas@gmail.com> Signed-off-by: schu <schu-github@schulog.org>
* ref test: update a forgotten repo -> repo2Carlos Martín Nieto2011-05-051-1/+1
| | | | | | | Commit 34e5d87e0512f2a3dfd6 left one of these unchanged we're trying to read from a free'd repository. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* Change implementation of refs tests that alter the current repository to ↵nulltoken2011-05-011-27/+19
| | | | make them run against a temporary clone of the test repository
* tests: don't leak objectsCarlos Martín Nieto2011-04-131-0/+4
| | | | | | | If we don't create any leaks in the tests, we can use them to search for leaks in the implementation. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* refs: Fix issue when packing weak tagsVicent Marti2011-04-081-2/+7
| | | | | Weak tags (e.g. tags that point directly to a normal object instead of a tag object) were failing to be packed.
* Fix tag reference name in testrepo.gitnulltoken2011-04-041-1/+6
| | | | | | | The git test repository was holding a wrongly named tag reference ("very-simple") pointing at a tag named "e90810b". This mistake (mine :-/ ) originates back to https://github.com/libgit2/libgit2/commit/9282e92 Whole credit goes to @tclem for having spotted this.
* Add test ensuring one can not create an oid reference which targets at an ↵nulltoken2011-03-291-0/+21
| | | | unknown id
* Replace gitfo_unlink() calls with git_reference_delete() in refs related testsnulltoken2011-03-291-6/+3
|
* Check for looser reference namesCarlos Martín Nieto2011-03-291-1/+2
| | | | | | | res/dummy/a and refs/stash must pass. The other rules are already tested by the rest of the checks. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* Enforce coding conventions in refs.cVicent Marti2011-03-291-5/+5
| | | | | Internal methods are static and without the git prefix. 'Force' methods have a `_f` prefix to match the other 'force' methods.
* Make overwrite test more comprehensiveCarlos Martín Nieto2011-03-291-3/+42
| | | | Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* force-rename test: check for the right nameCarlos Martín Nieto2011-03-291-3/+3
| | | | Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* Add tests covering overwriting referencesCarlos Martín Nieto2011-03-291-0/+98
| | | | Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* Do not segfault when listing unpacked referencesVicent Marti2011-03-151-0/+19
|
* Remove duplicate refs in `git_reference_listall`Vicent Marti2011-03-151-1/+5
|
* Add new method `git_reference_listall`Vicent Marti2011-03-141-0/+13
| | | | | | | Lists all the references in a repository. Listing may be filtered by reference type. This should applease Lord Clem.