Commit Graph

252 Commits

Author SHA1 Message Date
Vicent Marti
2869f404fd transport: Add git_transport_valid_url 2011-11-22 15:49:23 +01:00
Carlos Martín Nieto
6616e20750 Add a note not to free the result from git_remote_ls 2011-11-22 11:18:27 +01:00
Vicent Martí
bec92f78bf Merge pull request #492 from carlosmn/networking
Networking improvements
2011-11-21 17:12:23 -08:00
Vicent Marti
2744806f32 tree: Fix documentation 2011-11-22 02:10:41 +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
Haitao Li
28ba94ceed Fix typo in repository documentation 2011-11-18 17:47:22 +08:00
Vicent Marti
2cbca8b06c include: Unify internal include strategies
Do not add the `git2` path to internal includes, or that will cause
an extra path dependency.
2011-11-18 01:43:27 +01:00
Vicent Marti
2ba14f2367 tree: Add payload to git_tree_walk 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
Vicent Marti
a15c550db8 threads: Fix the shared global state with TLS
See `global.c` for a description of what we're doing.

When libgit2 is built with GIT_THREADS support, the threading system
must be explicitly initialized with `git_threads_init()`.
2011-11-16 14:09:44 +01:00
Vicent Marti
d4a0b124d0 refs: Partial rewrite for read-only refs
This new version of the references code is significantly faster and
hopefully easier to read.

External API stays the same. A new method `git_reference_reload()` has
been added to force updating a memory reference from disk. In-memory
references are no longer updated automagically -- this was killing us.

If a reference is deleted externally and the user doesn't reload the
memory object, nothing critical happens: any functions using that
reference should fail gracefully (e.g. deletion, renaming, and so on).

All generated references from the API are read only and must be free'd
by the user. There is no reference counting and no traces of generated
references are kept in the library.

There is no longer an internal representation for references. There is
only one reference struct `git_reference`, and symbolic/oid targets are
stored inside an union.

Packfile references are stored using an optimized struct with flex array
for reference names. This should significantly reduce the memory cost of
loading the packfile from disk.
2011-11-06 03:15:34 +01:00
schu
a46ec45746 refs: split internal and external references
Currently libgit2 shares pointers to its internal reference cache with
the user. This leads to several problems like invalidation of reference
pointers when reordering the cache or manipulation of the cache from
user side.

Give each user its own git_reference instead of leaking the internal
representation (struct reference).

Add the following new API functions:

	* git_reference_free
	* git_reference_is_packed

Signed-off-by: schu <schu-github@schulog.org>
2011-11-06 03:15:19 +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
Vicent Marti
da37654d04 tree: Add traversal in post-order 2011-10-27 22:33:31 -07:00
Vicent Marti
11d51ca631 windows: Add support for non-UTF codepages
Our previous assumption that all paths in Windows are encoded in UTF-8
is rather weak, specially when considering that Git is
encoding-agnostic.

These set of functions allow the user to change the library's active
codepage globally, so it is possible to access paths and files on all
international versions of Windows.

Note that the default encoding here is UTF-8 because we assume that 99%
of all Git repositories will be in UTF-8.

Also, if you use non-ascii characters in paths, anywhere, please burn on
a fire.
2011-10-26 17:43:44 -07:00
Vicent Marti
28c1451a7c tree: Fix name lookups once and for all
Double-pass binary search. Jeez.
2011-10-20 02:40:14 +02:00
Vicent Marti
8cf2de078d tree: Fix lookups by entry name 2011-10-19 01:34:42 +02: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
Vicent Martí
92e2081f40 Merge pull request #449 from csware/include-win-version-information
Include windows version information in git2.dll
2011-10-12 11:03:58 -07:00
Sven Strickroth
96fab093e3 put version information in separate file
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2011-10-09 18:39:52 +02:00
Sven Strickroth
314f54eb06 fix build for x64
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2011-10-09 05:29:57 +02:00
Vicent Marti
dd3fd68266 msvc: Remove superfluous includes 2011-10-05 13:44:27 -07:00
Vicent Marti
c060854ed5 msvc: Properly handle inttypes.h/stdint.h 2011-10-05 16:21:16 -04:00
Carlos Martín Nieto
dc8e3096d6 Include stdint.h in git2/config.h
Otherwise MSVC doesn't know what we're talking about when we say
int32_t or int64_t.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-01 02:09:35 +02:00
Vicent Marti
fafd471021 config: Proper type declarations for 64 bit ints 2011-09-30 16:08:41 +02:00
Carlos Martín Nieto
c36280a036 repository: export git_repository_config_autoload
Take the opportunity to finish the comment about this function.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-09-30 06:28:22 +02:00
Vicent Marti
8af4d074cc odb: Let users decide compression level for the loose ODB 2011-09-29 15:34:17 +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
Carlos Martín Nieto
4c562347ae Add git_config_find_system
This allows the library to guess where the system configuration file
should be located.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-09-27 14:39:38 +02:00
nulltoken
ad196c6ae6 config: make git_config_[get|set]_long() able to properly deal with 8 bytes wide values
Should fix issue #419.

Signed-off-by: nulltoken <emeric.fermas@gmail.com>
2011-09-22 18:58:47 +02:00
Vicent Martí
6640266e5a Merge pull request #398 from carlosmn/config-autohome
git_repository_config: open global config file automatically
2011-09-18 19:58:22 -07:00
Vicent Martí
e311519dce Merge pull request #411 from boyski/gcc4
Don't use '__attribute__ visibility' with gcc unless it's at version 4 or better
2011-09-18 19:38:14 -07:00
David Boyce
d2a1861ea1 Don't use '__attribute__ visibility' with gcc unless it's at
version 4 or better.
2011-09-18 21:27:25 -04: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
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
nulltoken
3601c4bfce repository: Add git_repository_head() 2011-09-15 01:13:50 +02:00
David Boyce
d911172255 Standardized doxygen @return lines for int functions to say "GIT_SUCCESS or an error code". 2011-09-13 12:30:25 -04:00
Carlos Martín Nieto
f9d4b0c395 git_repository_config: open global config file automatically
If the global configuration file is missing, it is ignored.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-09-12 17:25:46 +02:00
Sebastian Schuberth
26e74c6ace Fix some random size_t vs. int conversion warnings 2011-09-08 17:07:37 +02: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
Carlos Martín Nieto
a1be77cd35 Be smarter about selecting wants
There is no need to inspect what the local repository is like. Only
check whether the objects exist locally.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:09 +02:00
Carlos Martín Nieto
1564db11fe Remove enum git_whn
Instead, use flags inside the git_remote_head structure.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-08-18 02:34:09 +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