Commit Graph

5146 Commits

Author SHA1 Message Date
nulltoken
f2c2471389 Made path prettifying functions return GIT_EINVALIDPATH instead of GIT_ERROR. 2011-01-29 03:29:41 +02:00
nulltoken
2e6fd09c5d Fixed naming convention related issue. 2011-01-29 03:29:33 +02:00
nulltoken
eb2f3b4790 Made git_repository_open2() and git_repository_open3() benefit from recently added path prettifying function. 2011-01-29 03:29:32 +02:00
nulltoken
618818dcb7 Added git_prettify_file_path(). 2011-01-29 03:29:32 +02:00
nulltoken
4581c22abc Optimized git_prettify_dir_path() parsing. 2011-01-29 03:29:32 +02:00
nulltoken
9dd34b1e89 Made git_repository_open() and git_repository_init() benefit from recently added path prettifying function. 2011-01-29 03:29:32 +02:00
nulltoken
ae7ffea961 Fixed a parsing issue in git_prettify_dir_path(). 2011-01-29 03:29:32 +02:00
Vicent Marti
b29e8f1930 Return the created entry in git_tree_add_entry()
Yes, we are breaking the API. Alpha software, deal with it.

We need a way of getting a pointer to each newly added entry to the
index, because manually looking up the entry after creation is
outrageously expensive.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-01-29 02:12:59 +02:00
Vicent Marti
37c2d54c85 Fix compilation on MinGW
Require <sys/types.h> to find the definition for off64_t.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-01-20 15:57:13 -08:00
Vicent Marti
c8f5ff8f65 Fix initialization of in-memory trees
In-memory tree objects were not being properly initialized, because the
internal entries vector was created on the 'parse' method.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-01-20 14:43:27 -08:00
nulltoken
e16c2f6a4c Small enhancements to git_prettify_dir_path().
- Secured buffer ahead reading.
 - Guard against potential multiple dot path traversal (cf http://cwe.mitre.org/data/definitions/33.html)
2011-01-20 13:03:49 -08:00
Vicent Marti
e08b246cec Fix signed/unsigned comparison warning
Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-01-19 17:20:39 -08:00
Vicent Marti
b5e567b9fc Merge branch 'dir-path-prettifying' of https://github.com/nulltoken/libgit2 2011-01-19 17:18:01 -08:00
Sascha Peilicke
2d5ef6ad0d Set proper shared library soname. 2011-01-18 21:35:57 +01:00
Vicent Marti
ec3c7a16c2 Add new Repository initialization method
Lets the user specify the ODB that will be used by the repository
manually.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-01-13 04:54:14 +02:00
Vicent Marti
c5846fbf24 Fix typo on Commit API
Proper function is 'git_commit_time_offset'.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-01-13 04:34:23 +02:00
Vicent Marti
e52e38d380 Move the compat definitions to types.h
Don't need a brand new header for two typedefs when we already have a
types.h header.

Change comment style to ANSI C.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-01-12 01:44:06 +02:00
nulltoken
170d3f2fbb Added git_prettify_dir_path().
Clean up a provided absolute or relative directory path.

This prettification relies on basic operations such as coalescing multiple forward slashes into a single slash, removing '.' and './' current directory segments, and removing parent directory whenever '..' is encountered. If not empty, the returned path ends with a forward slash.

For instance, this will turn "d1/s1///s2/..//../s3" into "d1/s3/".

This only performs a string based analysis of the path. No checks are done to make sure the path actually makes sense from the file system perspective.
2011-01-11 20:12:53 +01:00
Alex Budovski
f0bde7fac0 Revised platform types to use 'best supported' size.
This will allow graceful migration to 64 bit file sizes and timestamps should
git's binary interface be extended to allow this.
2011-01-11 18:31:55 +11:00
Alex Budovski
e0c23b88c5 Remove unused variable. 2011-01-11 17:52:45 +11:00
Alex Budovski
0a3bcad07e Fix Windows build with forced bit truncation.
Windows uses a 64 bit time_t by default and assigning to unsigned int causes a
64 -> 32 bit truncation warning. This change forces the truncation,
acknowledging the implications detailed in the file comments. Also, blobs are
limited to 32 bit file sizes for the same reason (on all platforms).
2011-01-10 15:12:29 +11:00
Vicent Marti
073fa81241 Use generic types in git_index_entry
Off_t is not cool. It can be 32 or 64 bits depending on the platform,
but on the Index format, it's always 32 bits.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-01-10 05:01:38 +02:00
Vicent Marti
0740b462da Merge branch 'master' of https://github.com/Neopallium/libgit2 2011-01-08 22:24:28 +02:00
Alex Budovski
a17777d161 Fixed two buffer handling errors in vector.c
- remove() would read one-past array bounds.
- resize() would fail if the initial size was 1, because it multiplied by 1.75
  and truncated the resulting value. The buffer would always remain at size 1,
  but elements would repeatedly be appended (via insert()) causing a crash.
2011-01-08 22:17:52 +02:00
Alex Budovski
9ace34c8de Revised build configuration for MSVC.
Major changes and rationale:
- /WX: absolutely vital when compiling in C-mode as the compiler is
  incredibly lenient on what is allowed to compile. It allows functions to be
  called without prototypes declared, treating them as functions returning int
  taking an unspecified (read: unrestricted) list of arguments, without any
  type checking! It will simply issue a warning, which is easily overlooked.

  A real example: it will allow you to call ceil(1.75) without first including
  <math.h> causing UB, returning bogus results like 1023 on the machine I
  tested on.

- Release build separate from debug.
  Presently release builds don't exist.  Consequently they are completely
  untested. Many bugs may only manifest themselves in release mode. The current
  configuration sets debug-only flags like /RTC1 which are incompatible with
  optimization (/O2).

  In addition, the Windows build of libgit2 has no optimized version. This
  change resolves this.

- Added checksum generation in image headers. This is so debuggers don't
  complain about checksum mismatches and provides a small amount of consistency
  to binaries.
2011-01-08 22:17:01 +02:00
Vicent Marti
6f9024a72b Add Delphi bindings to the readme
Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-01-08 21:54:14 +02:00
Scott Chacon
e04c709551 added links to php and lua bindings 2011-01-08 08:02:45 -08:00
Robert G. Jakabosky
4b64c37f68 Fixed memory leak in git_commit__free(). 2011-01-08 02:22:22 -08:00
Vicent Marti
2645053be2 Find proper path to 'ldconfig' on wscript
Don't hardcode the '/sbin/ldconfig' path; also, don't run anything if
ldconfig cannot be found (Mac OS X, for instance).

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-01-04 01:17:07 +02:00
Vicent Marti
e52ed7a559 Split object methods from repository.c
All the relevant git_object methods have been moved to object.c

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-01-03 22:34:27 +02:00
Vicent Marti
fb3cd6bca4 Make internal methods static
Keep all the repository init code as static.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-01-03 21:46:18 +02:00
Vicent Marti
d5f2520413 Merge branch 'repo-init' of https://github.com/nulltoken/libgit2 into nulltoken-repo-init 2011-01-03 21:41:19 +02:00
Vicent Marti
e0646b38c7 Add generic hash function to util.c
It's MurmurHash3 slightly edited to make it
cross-platform. Fast and neat.

Use this for hashing strings on hash tables instead
of a full SHA1 hash. It's very fast and well distributed.

Obviously not crypto-secure.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2010-12-30 00:31:58 +02:00
nulltoken
951d06e4e9 Fixed placement of pointer argument. 2010-12-26 17:00:35 +01:00
nulltoken
98e3b29895 Merge branch 'master' into repo-init 2010-12-23 09:22:15 +01:00
Vicent Marti
51035184dd Prevent test manifests from being run
The test runner was running the manifest and other crap files. Now it
filters out to just the executables.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2010-12-23 01:00:40 +02:00
Vicent Marti
e6c8966d37 Merge branch 'call-ldconfig-on-unix' of https://github.com/marvil07/libgit2 2010-12-23 00:49:34 +02:00
Vicent Marti
f464965584 Merge branch 'waf-pkgconfig-typo' of https://github.com/marvil07/libgit2 2010-12-23 00:48:35 +02:00
Vicent Marti
e035685f27 Revert "Properly export all external symbols in Win32"
It is not a good idea to export these internal symbols now that they are
not required to run the unit tests.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2010-12-23 00:44:41 +02:00
Vicent Marti
e7379f3384 Link tests with the raw objects
Fix the test building issues once for all; each test is linked
with the raw objects of the library, not with any compiled version. That
way we make sure the tests always run, and are always linked with the
latest and most up-to-date version of the code.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2010-12-23 00:43:07 +02:00
Vicent Marti
9f54fe482d Remove git_errno
It was not being used by any methods (only by malloc and calloc), and
since it needs to be TLS, it cannot be exported on DLLs on Windows.

Burn it with fire. The API always returns error codes!

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2010-12-23 00:15:09 +02:00
Vicent Marti
11f6646f03 Export TLS symbols properly in Win32
There was no export definition for GIT_EXTERN_TLS() under MSVC.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2010-12-22 22:51:24 +02:00
Vicent Marti
2a18a792e3 Properly export all external symbols in Win32
Some external functions were not being exported because they were using
the 'extern' keyword instead of the generic GIT_EXTERN() macro.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2010-12-22 22:43:39 +02:00
Vicent Marti
0847dff5cd Fix test builds in Win32
Use forward slashes for the TEST_RESOURCES definition. libgit2 uses only
forward slashes.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2010-12-22 21:57:48 +02:00
Marco Villegas
a58e6a5fc9 Run ldconfig on install at unix platforms. 2010-12-22 13:40:39 -05:00
Marco Villegas
bd6eb23022 minor: Let waf write the right values for prefix and libdir at pkg-config file. 2010-12-22 04:09:24 -05:00
nulltoken
2c08c3f074 Made is_windows_rooted_path() able to cope with awkward but valid relative paths such as "C:..\File.txt".
Path "C:..\File.txt" refers to a file called File.txt located in the parent directory of the current directory on drive C:.
2010-12-21 06:52:07 +01:00
nulltoken
23a1edbd04 Wrapped the detection of a Windows rooted path within a conditional compilation directive. 2010-12-21 05:43:47 +01:00
nulltoken
f2d6a23aa6 Small code maintenability improvement. 2010-12-21 05:21:33 +01:00
nulltoken
8ea2c83b5d Added creation of 'objects/info' and 'objects/pack' directories. 2010-12-20 16:46:13 +01:00