Commit Graph

31 Commits

Author SHA1 Message Date
Vicent Marti
d88d4311c7 remote: Cleanup the remotes code
- Hide the remaining transports code
- Drop `git_headarray`, switch to using a callback to list refs. Makes
the code cleaner.
2011-11-28 08:40:40 +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
391575638c Free the created refs in git_remote_update_tips 2011-11-22 11:16:44 +01:00
Carlos Martín Nieto
a31471140f Set transport to NULL after freeing it 2011-11-22 10:31:32 +01:00
Vicent Marti
4bef35656e remote: Assert things that should be asserted 2011-11-22 02:16:20 +01:00
Carlos Martín Nieto
6ac3b707b1 Add git_remote_connected
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-11-21 21:00:43 +01:00
Carlos Martín Nieto
4cf01e9a1a Add git_remote_disconnect
It can be useful to separate disconnecting from actually destroying
the object.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-11-21 21:00:42 +01:00
Carlos Martín Nieto
617bfdf47f Add a name to a remote created from the API
Make it a bit more resilient.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-11-18 21:39:34 +01:00
Carlos Martín Nieto
95057b8503 remote: get rid of git_remote_negotiate
There is no good reason to expose the negotiation as a different step
to downloading the packfile.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-11-18 21:18:39 +01: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
517bda196e fetch: store FETCH_HEAD
We should always save the remote's HEAD as FETCH_HEAD locally.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-08 02:28:02 +02:00
Vicent Martí
71a4c1f16f Merge pull request #384 from kiryl/warnings
Add more -W flags to CFLAGS
2011-09-18 20:07:59 -07:00
Vicent Martí
b3c524d104 Merge pull request #399 from carlosmn/free-null
Add checks for NULL to the config and remote free functions
2011-09-18 19:46:12 -07: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
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
Carlos Martín Nieto
2aae218881 Add checks for NULL to the config and remote free functions
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-09-13 02:05:12 +02:00
Kirill A. Shutemov
d568d5856b CMakefile: add -Wmissing-prototypes and fix warnings
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-08-30 23:55:22 +03:00
Carlos Martín Nieto
778e1c739b Add git_remote_new
As we no longer expose the transport functions, this is now the only
way to connect to a remote when given an URL instead of a remote name

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-30 19:37:14 +02:00
Carlos Martín Nieto
b5a8aa94bf Don't hide the transport details
Transports shouldn't get used outside of the library, so don't expose
accessor functions.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-30 19:37:14 +02:00
Kirill A. Shutemov
932669b865 Drop STRLEN() macros
There is no need in STRLEN macros. Compilers can do this trivial
optimization on its own.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-08-25 16:41:15 +03:00
Vicent Marti
84dd3820d4 posix: Properly handle snprintf in all platforms 2011-08-18 02:35:28 +02:00
Carlos Martín Nieto
441f57c2b7 Add git_remote_update_tips
This function updates the references in the local reference storage to
match the ones in the remote.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:08 +02:00
Carlos Martín Nieto
48a65a071d Only wait for pack if we need it
Provide the git_remote_download function to instruct the library to
downlad the packfile and let the user know the temporary location.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:08 +02:00
Carlos Martín Nieto
e1d8803068 Don't expose the fetch code to the user
Move the generation of the want-list to be done from the negotiate
function, and keep the filtered references inside the remote
structure.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:08 +02:00
Carlos Martín Nieto
44daec4229 Bind the configuration and remotes to a repository
Configurations when taken from a repository and remotes should be
identifiable as coming from a particular repository. This allows us to
reduce the amount of variables that the user has to keep track of.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:08 +02:00
Carlos Martín Nieto
b4c9063040 Implement sending haves
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:07 +02:00
Carlos Martín Nieto
0e20ba6066 Add a generic send_wants
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:07 +02:00
Carlos Martín Nieto
0ac2726fdf Slim down git_transport
Remove the unused repo and private pointers and make the direction a
flag, as it can only have two states. Change the connect signature to
use an int instead of git_net_direction and remove that enum.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-06-27 20:23:47 +02:00
Carlos Martín Nieto
9ba49bb5c8 Add git_remote_connect and git_remote_ls
These allow you to implement git-ls-remote when given a reference name
and a repository.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-06-27 02:12:40 +02:00
Carlos Martín Nieto
2dc31040a2 Abstract the refspec query and parse
Move them to their own functions to avoid duplication and to make it
easier to ignore missing configuration.

Not finding 'fetch' is considered fatal, though this might not be
correct behaviour (push-only remotes?)

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-06-26 18:18:10 +02:00
Carlos Martín Nieto
9c82357be7 Add a remotes API
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-06-26 18:18:10 +02:00