|
35786cb7
|
2011-02-02T19:00:26
|
|
Use Git's own tree entry sorting algorithm
If plain strcmp is used, as this code did before, the final sorting may
end up different from what git-add would do (for example, 'boost'
appearing before 'boost-build.jam', because Git sorts as if it were
spelled 'boost/').
If the sorting is incorrect like this, Git 1.7.4 insists that unmodified
files have been modified. For example, my test repository has these
four entries:
drwxr-xr-x 199 johnw wheel 6766 Feb 2 17:21 boost
-rw-r--r-- 1 johnw wheel 849 Feb 2 17:22 boost-build.jam
-rw-r--r-- 1 johnw wheel 989 Feb 2 17:21 boost.css
-rw-r--r-- 1 johnw wheel 6308 Feb 2 17:21 boost.png
Here is the output from git-ls-tree for these files, in a commit tree
created using git-add and git-commit:
100644 blob 8b8775433aef73e9e12609610ae2e35cf1e7ec2c boost-build.jam
100644 blob 986c4050fa96d825a1311c8e871cdcc9a3e0d2c3 boost.css
100644 blob b4d51fcd5c9149fd77f5ca6ed2b6b1b70e8fe24f boost.png
040000 tree 46537eeaa4d577010f19b1c9e940cae9a670ff5c boost
Here is the output for the same commit produced using libgit2:
040000 tree c27c0fd1436f28a6ba99acd0a6c17d178ed58288 boost
100644 blob 8b8775433aef73e9e12609610ae2e35cf1e7ec2c boost-build.jam
100644 blob 986c4050fa96d825a1311c8e871cdcc9a3e0d2c3 boost.css
100644 blob b4d51fcd5c9149fd77f5ca6ed2b6b1b70e8fe24f boost.png
Due to this reordering, git-status claims the three blobs are always
modified, no matter what I do using git-read-tree or git-reset or
git-checkout to update the index.
|
|
bf3389b9
|
2011-02-01T05:57:45
|
|
Fixed bug where git__source_printf needs multiple attempts
|
|
89f9fc6f
|
2011-01-28T02:41:59
|
|
Make git_tree_clear_entries visible to the user
|
|
9217bbda
|
2011-02-01T05:00:52
|
|
Fixed a bug with the way commits are written
|
|
75e051c6
|
2011-01-27T14:20:23
|
|
Added git_tree_add_entry_unsorted and git_tree_sort_entries
|
|
2f8a8ab2
|
2011-01-29T01:56:25
|
|
Refactor reference parsing code
Several changes have been committed to allow the user to create
in-memory references and write back to disk. Peeling of symbolic
references has been made explicit. Added getter and setter methods for
all attributes on a reference. Added corresponding documentation.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
9282e921
|
2010-12-27T20:34:19
|
|
Merge nulltoken's reference parsing code
All the commits have been squashed into a single one before refactoring
the final code, to keep everything tidy.
Individual commit messages are as follows:
Added repository reference looking up functionality placeholder.
Added basic reference database definition and caching infrastructure.
Removed useless constant.
Added GIT_EINVALIDREFNAME error and description. Added missing description for GIT_EBAREINDEX.
Added GIT_EREFCORRUPTED error and description.
Added GIT_ETOONESTEDSYMREF error and description.
Added resolving of direct and symbolic references.
Prepared the packed-refs parsing.
Added parsing of the packed-refs file content.
When no loose reference has been found, the full content of the packed-refs file is parsed. All of the new (i.e. not previously parsed as a loose reference) references are eagerly stored in the cached references storage.
The method packed_reference_file__parse() is in deer need of some refactoring. :-)
Extracted to a method the parsing of the peeled target of a tag.
Extracted to a method the parsing of a standard packed ref.
Fixed leaky removal of the cached references.
Ensured that a previously parsed packed reference isn't returned if a more up-to-date loose reference exists.
Enhanced documentation of git_repository_reference_lookup().
Moved some refs related constants from repository.c to refs.h.
Made parsing of a packed tag reference more robust.
Updated git_repository_reference_lookup() documentation.
Added some references to the test repository.
Added some tests covering tag references looking up.
Added some tests covering symbolic and head references looking up.
Added some tests covering packed references looking up.
|
|
f2c24713
|
2011-01-26T20:29:06
|
|
Made path prettifying functions return GIT_EINVALIDPATH instead of GIT_ERROR.
|
|
2e6fd09c
|
2011-01-25T21:52:24
|
|
Fixed naming convention related issue.
|
|
eb2f3b47
|
2011-01-23T19:01:57
|
|
Made git_repository_open2() and git_repository_open3() benefit from recently added path prettifying function.
|
|
618818dc
|
2011-01-23T16:15:11
|
|
Added git_prettify_file_path().
|
|
4581c22a
|
2011-01-22T14:38:47
|
|
Optimized git_prettify_dir_path() parsing.
|
|
9dd34b1e
|
2011-01-21T14:02:22
|
|
Made git_repository_open() and git_repository_init() benefit from recently added path prettifying function.
|
|
ae7ffea9
|
2011-01-22T14:04:32
|
|
Fixed a parsing issue in git_prettify_dir_path().
|
|
b29e8f19
|
2011-01-29T02:12:59
|
|
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>
|
|
37c2d54c
|
2011-01-20T15:57:13
|
|
Fix compilation on MinGW
Require <sys/types.h> to find the definition for off64_t.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
c8f5ff8f
|
2011-01-20T14:43:27
|
|
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>
|
|
e16c2f6a
|
2011-01-20T19:51:34
|
|
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)
|
|
b5e567b9
|
2011-01-19T17:15:02
|
|
Merge branch 'dir-path-prettifying' of https://github.com/nulltoken/libgit2
|
|
ec3c7a16
|
2011-01-13T04:54:14
|
|
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>
|
|
c5846fbf
|
2011-01-13T04:34:23
|
|
Fix typo on Commit API
Proper function is 'git_commit_time_offset'.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
e52e38d3
|
2011-01-12T01:42:07
|
|
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>
|
|
170d3f2f
|
2011-01-11T20:12:53
|
|
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.
|
|
f0bde7fa
|
2011-01-11T16:07:45
|
|
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.
|
|
e0c23b88
|
2011-01-11T17:50:37
|
|
Remove unused variable.
|
|
0a3bcad0
|
2011-01-10T14:57:06
|
|
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).
|
|
073fa812
|
2011-01-10T05:01:38
|
|
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>
|
|
0740b462
|
2011-01-08T22:24:28
|
|
Merge branch 'master' of https://github.com/Neopallium/libgit2
|
|
a17777d1
|
2011-01-07T11:35:43
|
|
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.
|
|
4b64c37f
|
2011-01-08T02:22:22
|
|
Fixed memory leak in git_commit__free().
|
|
e52ed7a5
|
2011-01-03T22:34:27
|
|
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>
|
|
fb3cd6bc
|
2011-01-03T21:46:18
|
|
Make internal methods static
Keep all the repository init code as static.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
d5f25204
|
2011-01-03T21:37:14
|
|
Merge branch 'repo-init' of https://github.com/nulltoken/libgit2 into nulltoken-repo-init
|
|
e0646b38
|
2010-12-30T00:31:58
|
|
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>
|
|
951d06e4
|
2010-12-26T17:00:35
|
|
Fixed placement of pointer argument.
|
|
98e3b298
|
2010-12-23T09:22:15
|
|
Merge branch 'master' into repo-init
|
|
e035685f
|
2010-12-23T00:44:41
|
|
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>
|
|
9f54fe48
|
2010-12-23T00:15:09
|
|
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>
|
|
11f6646f
|
2010-12-22T22:51:24
|
|
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>
|
|
2a18a792
|
2010-12-22T22:43:39
|
|
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>
|
|
2c08c3f0
|
2010-12-21T06:52:07
|
|
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:.
|
|
23a1edbd
|
2010-12-21T05:43:47
|
|
Wrapped the detection of a Windows rooted path within a conditional compilation directive.
|
|
f2d6a23a
|
2010-12-21T05:21:33
|
|
Small code maintenability improvement.
|
|
8ea2c83b
|
2010-12-20T16:46:13
|
|
Added creation of 'objects/info' and 'objects/pack' directories.
|
|
2e29957a
|
2010-12-20T10:56:32
|
|
Made gitfo_mkdir_recurs() skip creation of the root of the path if it looks like a Windows drive.
|
|
412de9a6
|
2010-12-20T10:43:23
|
|
Made gitfo_mkdir_recurs() gracefully recover when a given directory already exists.
|
|
40c44d2f
|
2010-12-19T22:50:20
|
|
Fix issues in repository initialization
Implemented recursive directory creation
Fix style issues
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
fe93dabe
|
2010-12-19T21:30:15
|
|
Merge branch 'repo-init' of https://github.com/nulltoken/libgit2 into nulltoken-repo-init
|
|
1c2c7c0d
|
2010-12-19T15:08:53
|
|
Added creation of ref/heads/ and refs/tags/ directories.
|
|
8ea7fbc0
|
2010-12-18T22:27:26
|
|
Fixed a nasty bug which was preventing correct generation of the signature.
|
|
b5ced41e
|
2010-12-18T02:35:45
|
|
Merge branch 'timezone'
|
|
638c2ca4
|
2010-12-18T02:10:25
|
|
Rename 'git_person' to 'git_signature'
The new signature struct is public, and contains information about the
timezone offset. Must be free'd manually by the user.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
28990938
|
2010-12-17T20:03:20
|
|
Prettified HEAD symlink generation.
|
|
d13e7e02
|
2010-12-17T15:58:30
|
|
Added a comment reminding that the gitfo_mkdir_recurs() is far from being fully implemented.
|
|
e1f8cad0
|
2010-12-17T14:45:02
|
|
Added basic HEAD file creation.
|
|
f0b2bfe5
|
2010-12-17T14:24:47
|
|
Made gitfo_mkdir_recurs() more tolerant.
Doesn't err any more when the directory already exists.
|
|
a67a096a
|
2010-12-17T10:41:56
|
|
Added creation of 'objects' and 'refs' directories.
|
|
58fcfc26
|
2010-12-17T10:36:58
|
|
Removed unnecessary git_repository_init_results handling.
|
|
1a5204a7
|
2010-12-17T10:08:01
|
|
Added gitfo_mkdir_recurs() placeholder.
|
|
08190e2a
|
2010-12-16T14:31:24
|
|
Simplified git_repository_init_results struct.
|
|
4b8e27c8
|
2010-12-15T18:25:15
|
|
Very first git_repository_init() draft.
|
|
1f080e2d
|
2010-12-13T03:43:56
|
|
Fix initialization & freeing of inexistent repos
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
fee065a0
|
2010-12-11T15:34:37
|
|
Made possible to parse a person with no specified timezone offset.
|
|
13710f1e
|
2010-12-10T16:30:06
|
|
Added timezone offset parsing and outputting.
|
|
6c14d641
|
2010-12-09T20:55:54
|
|
Fixed a memory leak in git_repository_lookup() when provided git_otype is invalid.
|
|
4eec2c0d
|
2010-12-07T03:55:46
|
|
Set short message when changing a commit's message
Yes, finally.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
a44fc1d4
|
2010-12-06T23:13:00
|
|
Fix type-conversion warnings
The types in the git_index_entry struct are now system-defaults, and get
truncated to uint32_t's when written back on the index.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
f5918330
|
2010-12-06T23:08:31
|
|
Add license file to all public headers
Yes, the public headers do need our license.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
44908fe7
|
2010-12-06T23:03:16
|
|
Change the library include file
Libgit2 is now officially include as
#include "<git2.h>"
or indidividual files may be included as
#include <git2/index.h>
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
d12299fe
|
2010-12-03T22:22:10
|
|
Change include structure for the project
The maze with include dependencies has been fixed.
There is now a global include:
#include <git.h>
The git_odb_backend API has been exposed.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
7d7cd885
|
2010-12-03T18:01:30
|
|
Decouple storage from ODB logic
Comes with two default backends: loose object and packfiles.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
86bfec39
|
2010-12-06T01:13:09
|
|
Revert changes in odb.c to eventually rebase
The odb.c will disappear after the decoupling changes.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
6f02c3ba
|
2010-12-05T20:18:56
|
|
Small source code readability improvements.
Replaced magic number "0" with GIT_SUCCESS constant wherever it made sense.
|
|
691aa968
|
2010-12-02T18:35:38
|
|
Add 'git_repository_open2' to customize repo folders
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
eec95235
|
2010-12-02T04:58:22
|
|
Commit parents now use the common 'vector' code
No more linked lists, no more O(n) access.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
41109a7e
|
2010-12-02T04:42:33
|
|
Merge branch 'commitparents' of https://github.com/JustinLove/libgit2 into JustinLove-commitparents
|
|
c4034e63
|
2010-12-02T04:31:54
|
|
Refactor all 'vector' functions into common code
All the operations on the 'git_index_entry' array and the
'git_tree_entry' array have been refactored into common code in the
src/vector.c file.
The new vector methods support:
- insertion: O(1) (avg)
- deletion: O(n)
- searching: O(logn)
- sorting: O(logn)
- r. access: O(1)
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
eb095435
|
2010-11-30T21:28:39
|
|
add git_commit_parent to retrieve a parent by index
|
|
12114415
|
2010-11-30T21:01:47
|
|
add git_commit_parentcount
|
|
8c1f9e4d
|
2010-11-29T18:07:17
|
|
Make the bitmasks for Index Entry flags public
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
91e88941
|
2010-11-29T18:06:22
|
|
Properly write Index Entry 'flags_extended'
Always write the 'flags_extended' attribute to disk if it's available.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
25e9b4dd
|
2010-11-24T17:48:31
|
|
Do proper symbol exports on MSVC
Yes, if you are wondering why the shared library was
failing to build under MSVC, it's because it was empty.
Oh wow.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
322086f9
|
2010-11-24T17:46:46
|
|
Do not use STDINT types in public headers
Old versions of MSVC don't have such types available.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
824f4acd
|
2010-11-23T22:33:28
|
|
Fix redeclaration warnings in MSVC
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
8b0e448f
|
2010-11-23T16:51:18
|
|
Removed unreachable code (MSVC warning)
|
|
43e380a8
|
2010-11-23T15:18:53
|
|
Fix gitfo_isdir() in Win32 systems
Because adhering to the POSIX standards is overrated.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
6b1eab39
|
2010-11-23T14:36:31
|
|
Fix MSVC warnings and errors
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
30b171a1
|
2010-11-20T17:37:32
|
|
Change blob API to return temp refs to the content
If the user wants permanent references, he can duplicate the temporary
one manually.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
69a09b7c
|
2010-11-19T17:17:46
|
|
Fix wrong pointer check in git__strdup
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
c3dd69a9
|
2010-11-17T04:59:11
|
|
Fix resizing the index array
No longer segfaults when resizing an empty array.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
50dd6ca5
|
2010-11-17T04:58:32
|
|
Fix repository initialization
We cannot assume that non-bare repositories have an index file, because
'git index' doesn't create it by default.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
111e3622
|
2010-11-16T03:24:39
|
|
Fix freeing blob objects from the ODB
The internal contents of the blob were being free'd but not the blob
object itself.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
c3a20d5c
|
2010-11-14T22:11:46
|
|
Add support for 'index add'
Actually add files to the index by creating their corresponding blob and
storing it on the repository, then getting the hash and updating the
index file.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
7a3924fc
|
2010-11-14T22:07:48
|
|
Fix overcomplicated return statement
Note to self: don't be stupid
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
237da401
|
2010-11-14T22:06:10
|
|
Add support for blob files
Blob files can now be loaded from the repository like all the other base
Git types.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
0be42199
|
2010-11-10T13:43:55
|
|
accessor for index entry count
|
|
69f0295c
|
2010-11-06T00:14:18
|
|
Fix compiler warning in commit.c
|
|
1081d909
|
2010-11-05T18:04:46
|
|
Fix parsing of commits that have no newlines in the message.
|
|
3f43678e
|
2010-11-07T01:24:45
|
|
Make the Index API public
Several private methods of the Index API are now public, including the
methods to remove, get and add index entries.
All the methods only take an integer value for the position of the entry
to get/remove. To get or remove entries based on their path names, look
them up first using the git_index_find method.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
88d035bd
|
2010-11-04T15:08:01
|
|
Update commit_time along with committer.
|