Commit Graph

38 Commits

Author SHA1 Message Date
Vicent Marti
45e79e3701 Rename all _close methods
There's no difference between `_free` and `_close` semantics: keep
everything with the same name to avoid confusions.
2011-11-26 08:48:00 +01:00
Vicent Marti
9462c47143 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.
2011-11-26 08:37:08 +01:00
Carlos Martín Nieto
533fda3b83 config: test saving config to new file 2011-11-26 02:00:18 +01:00
Brandon Casey
b026b00d9c tests-clay: remove extra semi-colon in clay_libgit2.h, add one to index/rename.c 2011-11-22 01:19:07 -06:00
Vicent Marti
bf038dab30 clay: Properly initialize filebuf 2011-11-22 02:06:24 +01:00
Russell Belfer
b762e576c6 filebuf: add GIT_FILEBUF_INIT and protect multiple opens and cleanups
Update all stack allocations of git_filebuf to use GIT_FILEBUF_INIT
and make git_filebuf_open and git_filebuf_cleanup safe to be called
multiple times on the same buffer.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-11-22 01:53:56 +01:00
Vicent Marti
1d09a1c88d clay: Merge manually @leto's tests from #485
This uses the new Clay code. As you can see, the diff is minimal... It
works!
2011-11-22 01:41:22 +01:00
Carlos Martín Nieto
e4c93a3927 Update clay instructions to use -vtap 2011-11-18 02:35:46 +01:00
Carlos Martín Nieto
c515b5bf1e Add test for renaming a file and adding it to the index
Thanks to Emeric.
2011-11-18 02:35:45 +01:00
Vicent Marti
d1a721c595 clay: Bump to 0.9.0, add TAP support
Comes with schu's stress tests for config files. Hopefully the diffs
will stay minimal from now on.
2011-11-18 01:40:35 +01:00
Vicent Marti
9432af36fc Rename git_tree_frompath to git_tree_get_subtree
That makes more sense to me.
2011-11-18 01:40:35 +01:00
Jonathan "Duke" Leto
7b6156108c Fix docs about the command to mix the clay tests 2011-11-16 10:22:13 -08:00
Carlos Martín Nieto
0c49ec2d3b Implement p_rename
Move the callers of git_futils_mv_atomic to use p_rename.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-11-07 20:34:27 +01:00
Vicent Martí
89fb8f025a Merge pull request #456 from brodie/perm-fixes
Create objects, indexes, and directories with the right file permissions
2011-10-28 19:04:23 -07:00
Vicent Marti
3286c408ec global: Properly use git__ memory wrappers
Ensure that all memory related functions (malloc, calloc, strdup, free,
etc) are using their respective `git__` wrappers.
2011-10-28 19:02:36 -07:00
schu
9ff46db911 tests-clay: move t01-rawobj.c to clay
Signed-off-by: schu <schu-github@schulog.org>
2011-10-24 23:51:28 +02:00
Brodie Rao
01ad7b3a9e *: 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".
2011-10-14 16:07:47 -07:00
Brodie Rao
ce8cd006ce 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.
2011-10-14 16:04:34 -07:00
nulltoken
3fa735ca3b tree: Add git_tree_frompath() which, given a relative path to a tree entry, retrieves the tree object containing this tree entry 2011-10-13 23:30:07 +02:00
nulltoken
34aff01002 oid: Add git_oid_streq() which checks if an oid and an hex formatted string are equal 2011-10-13 23:15:11 +02:00
schu
1d33bf9d02 tests-clay: add a readme file
Signed-off-by: schu <schu-github@schulog.org>
2011-10-07 23:13:09 +02:00
schu
681008c768 tests-clay: update clay
The clay script didn't match the latest version from upstream.
Additionaly, add core/strtol.c to complete porting the core tests to
clay.

Signed-off-by: schu <schu-github@schulog.org>
2011-10-07 23:02:02 +02:00
Vicent Marti
dfd0abda4d clay: Fix compilation under MSVC 2011-10-01 13:25:24 +02:00
Vicent Marti
d02a7d8330 Update Clay 2011-09-28 18:57:32 +02:00
Carlos Martín Nieto
40fe5fbea8 Make repo config loading automatic or completely explicit
git_repository_config wants to take the global and system paths again
so that one can be explicit if needed.

The git_repository_config_autoload function is provided for the cases
when it's good enough for the library to guess where those files are
located.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-09-27 14:40:56 +02:00
Paul Betts
76c15b7191 Revert changes to clay 2011-09-22 12:26:23 -07:00
Paul Betts
e1b8644467 Rewrite getenv to use Win32 version on Windows 2011-09-21 12:00:34 -07:00
Vicent Marti
a58881274d Fix clay under MinGW 2011-09-21 01:14:57 +03:00
Vicent Marti
468d0d1e1e Fix repository_config call in network::remotes 2011-09-19 06:32:56 +03:00
Carlos Martín Nieto
3a2626f32a Add remotes test to clay
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-09-19 06:17:28 +03:00
Vicent Marti
2014021b20 Backport t18 fixes to Clay 2011-09-19 05:41:25 +03:00
Vicent Marti
87d9869fc3 Tabify everything
There were quite a few places were spaces were being used instead of
tabs. Try to catch them all. This should hopefully not break anything.
Except for `git blame`. Oh well.
2011-09-19 03:34:49 +03:00
Vicent Marti
934fa904e9 Update Clay script 2011-09-16 19:49:18 +02:00
Vicent Marti
df297a1f65 Fix Clay compilation under Win32 2011-09-16 19:42:44 +02:00
Vicent Marti
fe4aa2066d Regenerate test suite 2011-09-16 05:47:18 +02:00
Vicent Marti
a5f8c1bd9e Add missing prototypes 2011-09-16 05:46:18 +02:00
Vicent Marti
11385c3c4b Add sample "Status" clay tests 2011-09-16 05:13:44 +02:00
Vicent Marti
f1558d9bca Come out and Clay 2011-09-15 01:12:46 +02:00