summaryrefslogtreecommitdiff
path: root/tests/t12-repo.c
Commit message (Collapse)AuthorAgeFilesLines
* Removing test suites that have been ported to Clar:Ben Straub2012-03-311-183/+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
* Move path related functions from fileops to pathRussell Belfer2012-01-171-1/+1
| | | | | | | | | | | 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-17/+26
| | | | | | | | | | | | | | | | | | | | 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.
* repository: Change ownership semanticsVicent Marti2011-11-261-291/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ownership semantics have been changed all over the library to be consistent. There are no more "borrowed" or duplicated references. Main changes: - `git_repository_open2` and `3` have been dropped. - Added setters and getters to hotswap all the repository owned objects: `git_repository_index` `git_repository_set_index` `git_repository_odb` `git_repository_set_odb` `git_repository_config` `git_repository_set_config` `git_repository_workdir` `git_repository_set_workdir` Now working directories/index files/ODBs and so on can be hot-swapped after creating a repository and between operations. - All these objects now have proper ownership semantics with refcounting: they all require freeing after they are no longer needed (the repository always keeps its internal reference). - Repository open and initialization has been updated to keep in mind the configuration files. Bare repositories are now always detected, and a default config file is created on init. - All the tests affected by these changes have been dropped from the old test suite and ported to the new one.
* Free all used references in the source treeschu2011-11-061-0/+4
| | | | | | | Since references are not owned by the repository anymore we have to free them manually now. Signed-off-by: schu <schu-github@schulog.org>
* *: correct and codify various file permissionsBrodie Rao2011-10-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following files now have 0444 permissions: - loose objects - pack indexes - pack files - packs downloaded by fetch - packs downloaded by the HTTP transport And the following files now have 0666 permissions: - config files - repository indexes - reflogs - refs This brings libgit2 more in line with Git. Note that git_filebuf_commit() and git_filebuf_commit_at() have both gained a new mode parameter. The latter change fixes an important issue where filebufs created with GIT_FILEBUF_TEMPORARY received 0600 permissions (due to mkstemp(3) usage). Now we chmod() the file before renaming it into place. Tests have been added to confirm that new commit, tag, and tree objects are created with the right permissions. I don't have access to Windows, so for now I've guarded the tests with "#ifndef GIT_WIN32".
* fileops/repository: create (most) directories with 0777 permissionsBrodie Rao2011-10-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-3/+3
| | | | | Note: Functions exported from fileops take const mode_t, while the underlying POSIX wrappers take mode_t.
* Merge pull request #384 from kiryl/warningsVicent Martí2011-09-181-2/+2
|\ | | | | Add more -W flags to CFLAGS
| * CMakefile: add -Wmissing-prototypes and fix warningsKirill A. Shutemov2011-08-301-2/+2
| | | | | | | | Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* | status: enhance determination of status for a single filenulltoken2011-09-151-2/+0
|/ | | | | | - fix retrieval of a file status when working against a newly initialized repository - reduce memory pressure - prevents a directory from being tested
* t12-repo.c: fix failing test discover0schu2011-08-101-1/+1
| | | | | | discover0 tried to stat a non existing directory. Create it beforehand. Signed-off-by: schu <schu-github@schulog.org>
* discover: Make test run in temporary folder instead of altering the test ↵nulltoken2011-08-091-3/+3
| | | | resources folder
* tests: fix cast warningsKirill A. Shutemov2011-07-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | /home/kas/git/public/libgit2/tests/t00-core.c: In function ‘test_cmp’: /home/kas/git/public/libgit2/tests/t00-core.c:78:10: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/tests/t00-core.c:78:22: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/tests/t07-hashtable.c: In function ‘hash_func’: /home/kas/git/public/libgit2/tests/t07-hashtable.c:42:7: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/tests/t08-tag.c: In function ‘_gittest__write0’: /home/kas/git/public/libgit2/tests/t08-tag.c:141:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/tests/t08-tag.c: In function ‘_gittest__write2’: /home/kas/git/public/libgit2/tests/t08-tag.c:192:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/tests/t08-tag.c: In function ‘_gittest__write3’: /home/kas/git/public/libgit2/tests/t08-tag.c:227:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/tests/t04-commit.c: In function ‘_gittest__write0’: /home/kas/git/public/libgit2/tests/t04-commit.c:650:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/tests/t04-commit.c:651:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/tests/t04-commit.c: In function ‘_gittest__root0’: /home/kas/git/public/libgit2/tests/t04-commit.c:723:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/tests/t04-commit.c:724:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/tests/t12-repo.c: In function ‘write_file’: /home/kas/git/public/libgit2/tests/t12-repo.c:360:24: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* status: refactor the tests to remove some code duplicationnulltoken2011-07-121-9/+5
|
* refs: Cleanup reference renamingVicent Marti2011-07-061-7/+7
| | | | | | | `git_futils_rmdir_r`: rename, clean up. `git_reference_rename`: cleanup. Do not use 3x4096 buffers on the stack or things will get ugly very fast. We can reuse the same buffer.
* Remove duplicated recursive directory removal related codenulltoken2011-07-061-8/+7
|
* fileutils: Finish dropping the old `prettify_path`Vicent Marti2011-07-051-1/+1
|
* fileops: Drop `git_fileops_prettify_path`Vicent Marti2011-07-051-4/+4
| | | | | | | | | | The old `git_fileops_prettify_path` has been replaced with `git_path_prettify`. This is a much simpler method that uses the OS's `realpath` call to obtain the full path for directories and resolve symlinks. The `realpath` syscall is the original POSIX call in Unix system and an emulated version under Windows using the Windows API.
* fileops: CleanupVicent Marti2011-07-051-26/+26
| | | | | | | | | | | | | | | | 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.
* Hide ".git" directory on Windows upon creation of a non bare repositorynulltoken2011-06-291-0/+5
| | | | Directory which name starts with a dot are hidden on Linux platforms. This patch makes libgit2 behaves similarly on Windows.
* repo: Rename HEAD-related methodsVicent Marti2011-06-281-10/+10
|
* Add tests for detached and orphanCarlos Martín Nieto2011-06-281-0/+42
| | | | Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* Plug leaks in the repo discovery testsCarlos Martín Nieto2011-06-161-0/+2
| | | | Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* Merge pull request #261 from Romain-Geissler/discovery-path-v2Vicent Martí2011-06-151-1/+1
|\ | | | | Fix: GIT_PATH_PATH_SEPARATOR is now a semi-colon under Windows.
| * Fix: GIT_PATH_PATH_SEPARATOR is now a semi-colon under Windows.Romain Geissler2011-06-151-1/+1
| | | | | | | | | | GIT_PATH_LIST_SEPARATOR and GIT_PATH_MAX are made public so that it's can be used by a client.
* | Merge pull request #231 from Romain-Geissler/discovery-path-v2Vicent Martí2011-06-061-0/+137
|\ \ | |/ | | [Discovery path] Fix and tests
| * Repository: A little fix in error code. GIT_ENOTFOUND is returned when a ↵Romain Geissler2011-06-061-7/+5
| | | | | | | | | | | | gitfile is malformed and GIT_ENOTAREPO when the pointed dir is not a repo. Fixed tests so that it check the right error code.
| * Tests: Added tests for git_repository_discover.Romain Geissler2011-06-051-0/+139
| | | | | | | | | | Unfortunately, the across_fs flag can't be tested automaticly, as we can't create a temporary new filesystem.
* | repository: Export all internal pathsVicent Marti2011-06-041-4/+4
|/
* Add git_repository_is_bare() accessornulltoken2011-05-241-1/+8
|
* Add two new accessors to the repositorynulltoken2011-04-091-0/+4
| | | | git_repository_path() and git_repository_workdir() respectively return the path to the git repository and the working directory. Those paths are absolute and normalized.
* Add new method `git_repository_is_empty`Vicent Marti2011-04-081-0/+14
|
* Add test exercising the opening of an standard repository initialized by gitnulltoken2011-03-231-0/+19
|
* Add test exercising the opening of an empty bare repository initialized by gitnulltoken2011-03-231-0/+16
|
* Slightly enforce copy_recurs() behaviornulltoken2011-03-231-1/+0
| | | | The folder creation is now decorrelated from the recursive parsing of the source tree structure.
* Improve test coverage of new path prettifying behaviornulltoken2011-03-231-1/+34
|
* Change gitfo_prettify_dir_path() and gitfo_prettify_file_path() behaviornulltoken2011-03-231-12/+8
| | | | Those functions now return prettified rooted path.
* Add failing test for issue 84nulltoken2011-03-231-0/+22
| | | | see https://github.com/libgit2/libgit2/issues#issue/84
* clean up temp repo for t12-repo testsTim Clem2011-03-041-8/+17
| | | | | add actual must_pass calls back into the repo tests and remove ./ from beginning of temp repo path
* Cleanup the testing toolkitVicent Marti2011-03-031-27/+45
| | | | | | | | | | | | | | | | | | | Tests are now declared with detailed descriptions and a short test name: BEGIN_TEST(the_test0, "this is an example test that does something") ... END_TEST Modules are declared through a simple macro interface: BEGIN_MODULE(mod_name) ADD_TEST(the_test0); ... END_MODULE Error messages when tests fail have been greatly improved. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Refactored some test related constants.nulltoken2011-03-031-8/+6
|
* Added tests to exercise the initialization and the opening of a repository.nulltoken2011-03-031-0/+47
|
* Internal changes on the backend systemVicent Marti2011-02-091-0/+100
The priority value for different backends has been removed from the public `git_odb_backend` struct. We handle that internally. The priority value is specified on the `git_odb_add_alternate`. This is convenient because it allows us to poll a backend twice with different priorities without having to instantiate it twice. We also differentiate between main backends and alternates; alternates have lower priority and cannot be written to. These changes come with some unit tests to make sure that the backend sorting is consistent. The libgit2 version has been bumped to 0.4.0. This commit changes the external API: CHANGED: struct git_odb_backend No longer has a `priority` attribute; priority for the backend in managed internally by the library. git_odb_add_backend(git_odb *odb, git_odb_backend *backend, int priority) Now takes an additional priority parameter, the priority that will be given to the backend. ADDED: git_odb_add_alternate(git_odb *odb, git_odb_backend *backend, int priority) Add a backend as an alternate. Alternate backends have always lower priority than main backends, and writing is disabled on them. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Vicent Marti <tanoku@gmail.com>