Commit Graph

126 Commits

Author SHA1 Message Date
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
nulltoken
e3baa3ccf3 status: Fix a sorting issue in the treewalker
This ensures that entries from the working directory are retrieved according to the following rules:

 - The file "subdir" should appear before the file "subdir.txt"
 - The folder "subdir" should appear after the file "subdir.txt"
2011-10-29 22:42:37 +02:00
nulltoken
d1db74bf57 status: Prevent segfaulting when determining the status of a repository
Fixes #465
2011-10-29 22:05:56 +02: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
Carlos Martín Nieto
1ca715e07a status: move GIT_STATUS_PATH_* into an enum
Their actual values have no meaning, so pack them in an enum.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-27 16:13:09 -07:00
Carlos Martín Nieto
68a26dfa7c status: reorder retrieve_head_tree error checks
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-27 16:13:09 -07:00
Carlos Martín Nieto
c2892d61ac status: remove git_tree_entry_bypos
The only caller has been changed to treat a NULL tree as a special
case and use the existing git_tree_entry_byindex.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-27 16:13:09 -07:00
Carlos Martín Nieto
899cb7a876 status: remove git_index_entry_bypos
This function is already implemented (better) as git_index_get. Change
the only caller to use that function.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-27 16:13:09 -07:00
Vicent Marti
19d869bb2e Fix warning in status.c 2011-09-19 06:31:54 +03:00
Vicent Martí
71b84c639a Merge pull request #408 from schu/fixup-status
Fixup status.c
2011-09-18 19:55:48 -07:00
Vicent Marti
bb742ede3d Cleanup legal data
1. The license header is technically not valid if it doesn't have a
copyright signature.

2. The COPYING file has been updated with the different licenses used in
the project.

3. The full GPLv2 header in each file annoys me.
2011-09-19 01:54:32 +03:00
schu
855f06606d status.c: add missing check for error
dirent_cb() didn't check the return value of determine_status().

Signed-off-by: schu <schu-github@schulog.org>
2011-09-17 17:28:39 +02:00
schu
ef37489041 status.c: remove wrong address operator
Signed-off-by: schu <schu-github@schulog.org>
2011-09-17 12:14:13 +02:00
nulltoken
d8b903dab0 status: enhance determination of statuses for a whole directory
- Should increase performance through usage of a walker
 - No callback invocation for unaltered entries
2011-09-15 01:14:36 +02:00
nulltoken
56453d3468 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
2011-09-15 01:14:36 +02:00
Luc Bertrand
8f643ce8e3 Remove duplicated sort 2011-08-03 13:44:28 +02:00
Luc Bertrand
9d9e492dc0 remove unused variable 2011-08-03 13:38:02 +02:00
Luc Bertrand
8cf077f4d5 fix recurse_tree_entries, continue parsing tree after first subdirectory found 2011-08-03 13:37:24 +02:00
Carlos Martín Nieto
1a8167afbc status: don't hide tree closing
It's not obvious that recurse_tree_entries or recurse_tree_entry
should free a resource that wasn't allocated by them. Do this
explicitely and plug a leak while we're at it.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-14 00:06:24 +02:00
Carlos Martín Nieto
75c2002f97 status: plug some leaks
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-12 18:25:31 +02:00
Vicent Marti
c52736fa52 status: Cleanup
The `hashfile` function has been moved to ODB, next to `git_odb_hash`.

Global state has been removed from the dirent call in `status.c`,
because global state is killing the rainforest and causing global
warming.
2011-07-09 15:05:14 +02:00
Jason Penny
3b2a423c3f status: nonexistent file with git_status_file()
Throws GIT_ENOTFOUND error if given a filename that is not in
HEAD, index, nor the work tree.
2011-07-09 13:49:50 +02:00
Jason Penny
34dfea2774 status: handle subdirs for git_status_file 2011-07-09 13:49:50 +02:00
Jason Penny
20361b2f69 status: get status for single file
Add git_status_file to be able to retrieve status of single file by
supplying a path.
2011-07-09 13:49:50 +02:00
Jason Penny
3af6b34a76 status: get file statuses and run callback
Add git_status_foreach() to run a callback on each file passing the path
and a status value.
2011-07-09 13:49:50 +02:00
Jason Penny
205166d27c status: get blob object id of file on disk
Add git_status_hashfile() to get blob's object id for a file without adding
it to the object database or needing a repository at all.
This functionality is similar to `git hash-object` without '-w'.
2011-07-09 13:49:50 +02:00