tests/t12-repo.c


Log

Author Commit Date CI Message
Russell Belfer 97769280 2011-11-30T11:27:15 Use git_buf for path storage instead of stack-based buffers 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.
Vicent Marti 9462c471 2011-11-25T08:16:26 repository: Change ownership semantics 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.
schu 75abd2b9 2011-08-11T19:38:13 Free all used references in the source tree Since references are not owned by the repository anymore we have to free them manually now. Signed-off-by: schu <schu-github@schulog.org>
Brodie Rao 01ad7b3a 2011-09-06T15:48:45 *: correct and codify various file permissions 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".
Brodie Rao ce8cd006 2011-09-07T15:32:44 fileops/repository: create (most) directories with 0777 permissions 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.
Brodie Rao 33127043 2011-10-14T14:18:02 fileops/posix: replace usage of "int mode" with "mode_t mode" Note: Functions exported from fileops take const mode_t, while the underlying POSIX wrappers take mode_t.
Vicent Martí 71a4c1f1 2011-09-18T20:07:59 Merge pull request #384 from kiryl/warnings Add more -W flags to CFLAGS
nulltoken 56453d34 2011-09-02T13:44:42 status: enhance determination of status for a single file - fix retrieval of a file status when working against a newly initialized repository - reduce memory pressure - prevents a directory from being tested
Kirill A. Shutemov d568d585 2011-08-30T23:55:22 CMakefile: add -Wmissing-prototypes and fix warnings Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
schu befae28f 2011-08-10T21:19:21 t12-repo.c: fix failing test discover0 discover0 tried to stat a non existing directory. Create it beforehand. Signed-off-by: schu <schu-github@schulog.org>
nulltoken ccd122fd 2011-07-22T12:31:51 discover: Make test run in temporary folder instead of altering the test resources folder
Kirill A. Shutemov 84ef7f36 2011-07-15T18:34:20 tests: fix cast warnings /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>
nulltoken d4760a42 2011-07-12T11:29:36 status: refactor the tests to remove some code duplication
Vicent Marti 858dba58 2011-07-06T18:08:13 refs: Cleanup reference renaming `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.
nulltoken 1b938a58 2011-07-03T22:27:05 Remove duplicated recursive directory removal related code
Vicent Marti eec3fe39 2011-07-05T01:11:33 fileutils: Finish dropping the old `prettify_path`
Vicent Marti 5ad739e8 2011-07-04T20:05:11 fileops: Drop `git_fileops_prettify_path` 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.
Vicent Marti f79026b4 2011-07-04T11:43:34 fileops: Cleanup 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.
nulltoken 6ac91dfe 2011-06-29T14:06:18 Hide ".git" directory on Windows upon creation of a non bare repository Directory which name starts with a dot are hidden on Linux platforms. This patch makes libgit2 behaves similarly on Windows.
Vicent Marti c682886e 2011-06-28T21:09:22 repo: Rename HEAD-related methods
Carlos Martín Nieto f5e09d60 2011-06-28T14:11:24 Add tests for detached and orphan Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 038d2fc3 2011-06-16T20:24:51 Plug leaks in the repo discovery tests Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Vicent Martí ef9a6f4c 2011-06-15T13:47:41 Merge pull request #261 from Romain-Geissler/discovery-path-v2 Fix: GIT_PATH_PATH_SEPARATOR is now a semi-colon under Windows.
Romain Geissler 0657e46d 2011-06-15T12:36:08 Fix: GIT_PATH_PATH_SEPARATOR is now a semi-colon under Windows. GIT_PATH_LIST_SEPARATOR and GIT_PATH_MAX are made public so that it's can be used by a client.
Vicent Martí 7d170a4b 2011-06-06T18:11:15 Merge pull request #231 from Romain-Geissler/discovery-path-v2 [Discovery path] Fix and tests
Romain Geissler efcc87c9 2011-06-06T10:02:07 Repository: A little fix in error code. GIT_ENOTFOUND is returned when a gitfile is malformed and GIT_ENOTAREPO when the pointed dir is not a repo. Fixed tests so that it check the right error code.
Romain Geissler 76e9e3b7 2011-06-05T00:23:24 Tests: Added tests for git_repository_discover. Unfortunately, the across_fs flag can't be tested automaticly, as we can't create a temporary new filesystem.
Vicent Marti 602ee38b 2011-06-04T20:44:14 repository: Export all internal paths
nulltoken fa9bcd81 2011-05-24T21:48:07 Add git_repository_is_bare() accessor
nulltoken 4a34b3a9 2011-04-09T15:49:44 Add two new accessors to the repository 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.
Vicent Marti 41233c40 2011-04-08T12:42:18 Add new method `git_repository_is_empty`
nulltoken a8375f53 2011-03-05T15:09:01 Add test exercising the opening of an standard repository initialized by git
nulltoken 2ce44b67 2011-03-05T14:33:31 Add test exercising the opening of an empty bare repository initialized by git
nulltoken f428ae61 2011-03-19T08:19:34 Slightly enforce copy_recurs() behavior The folder creation is now decorrelated from the recursive parsing of the source tree structure.
nulltoken ba1bdf86 2011-03-18T22:27:15 Improve test coverage of new path prettifying behavior
nulltoken c90292ce 2011-03-18T16:56:43 Change gitfo_prettify_dir_path() and gitfo_prettify_file_path() behavior Those functions now return prettified rooted path.
nulltoken 677a3c07 2011-03-15T22:07:01 Add failing test for issue 84 see https://github.com/libgit2/libgit2/issues#issue/84
Tim Clem 45314a7e 2011-03-04T23:13:02 clean up temp repo for t12-repo tests add actual must_pass calls back into the repo tests and remove ./ from beginning of temp repo path
Vicent Marti 3dccfed1 2011-03-03T18:19:05 Cleanup the testing toolkit 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>
nulltoken 705a90ec 2011-02-26T14:07:13 Added tests to exercise the initialization and the opening of a repository.
nulltoken 7167422c 2011-02-28T12:16:44 Refactored some test related constants.
Vicent Marti d4b5a4e2 2011-02-09T19:49:02 Internal changes on the backend system 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>