Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-05-09msvc: Do not use `isspace` Vicent Martí
Locale-aware bullshit bitting my ass again yo
2012-05-03Remove old and unused error codesVicent Martí
2012-04-25Moving power-of-two bit utilities into util.hRussell Belfer
2012-03-09error-handling: On-disk config file backendVicent Martí
Includes: - Proper error reporting when encountering syntax errors in a config file (file, line number, column). - Rewritten `config_write`, now with 99% less goto-spaghetti - Error state in `git_filebuf`: filebuf write functions no longer need to be checked for error returns. If any of the writes performed on a buffer fail, the last call to `git_filebuf_commit` or `git_filebuf_hash` will fail accordingly and set the appropiate error message. Baller!
2012-03-07Migrating diff to new error handlingRussell Belfer
Ended up migrating a bunch of upstream functions as well including vector, attr_file, and odb in order to get this to work right.
2012-03-07error-handling: RepositoryVicent Martí
This also includes droping `git_buf_lasterror` because it makes no sense in the new system. Note that in most of the places were it has been dropped, the code needs cleanup. I.e. GIT_ENOMEM is going away, so instead it should return a generic `-1` and obviously not throw anything.
2012-02-15util: add git__ishexschu
git__ishex allows to check if a string is a hexadecimal representation. Signed-off-by: schu <schu-github@schulog.org>
2012-02-13Update Copyright headerschu
Signed-off-by: schu <schu-github@schulog.org>
2012-01-17Patch cleanup for mergeRussell Belfer
After reviewing the gitignore support with Vicent, we came up with a list of minor cleanups to prepare for merge, including: * checking git_repository_config error returns * renaming git_ignore_is_ignored and moving to status.h * fixing next_line skipping to include \r skips * commenting on where ignores are and are not included
2012-01-12Initial implementation of gitignore supportRussell Belfer
Adds support for .gitignore files to git_status_foreach() and git_status_file(). This includes refactoring the gitattributes code to share logic where possible. The GIT_STATUS_IGNORED flag will now be passed in for files that are ignored (provided they are not already in the index or the head of repo).
2012-01-05Merge remote-tracking branch 'nulltoken/topix/path_fromurl' into developmentVicent Martí
Conflicts: tests-clay/clay.h tests-clay/clay_main.c
2011-12-31Improved gitattributes macro implementationRussell Belfer
This updates to implementation of gitattribute macros to be much more similar to core git (albeit not 100%) and to handle expansion of macros within macros, etc. It also cleans up the refcounting usage with macros to be much cleaner. Also, this adds a new vector function `git_vector_insert_sorted()` which allows you to maintain a sorted list as you go. In order to write that function, this changes the function `git__bsearch()` to take a somewhat different set of parameters, although the core functionality is still the same.
2011-12-29Add support for macros and cache flush API.Russell Belfer
Add support for git attribute macro definitions. Also, add support for cache flush API to clear the attribute file content cache when needed. Additionally, improved the handling of global and system files, making common utility functions in fileops and converting config and attr to both use the common functions. Adds a bunch more tests and fixed some memory leaks. Note that adding macros required me to use refcounted attribute assignment definitions, which complicated, but probably improved memory usage.
2011-12-28util: add git__fromhex()nulltoken
2011-12-21Add APIs for git attributesRussell Belfer
This adds APIs for querying git attributes. In addition to the new API in include/git2/attr.h, most of the action is in src/attr_file.[hc] which contains utilities for dealing with a single attributes file, and src/attr.[hc] which contains the implementation of the APIs that merge all applicable attributes files.
2011-11-26util: Remove unused macroVicent Marti
2011-11-26refcount: Fix off-by one errorVicent Marti
2011-11-26repository: Change ownership semanticsVicent Marti
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-10-29global: Properly use `git__` memory wrappersVicent Marti
Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
2011-09-30config: Proper type declarations for 64 bit intsVicent Marti
2011-09-22config: make git_config_[get|set]_long() able to properly deal with 8 bytes ↵nulltoken
wide values Should fix issue #419. Signed-off-by: nulltoken <emeric.fermas@gmail.com>
2011-09-19Tabify everythingVicent Marti
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-19Cleanup legal dataVicent Marti
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-08Fix some random size_t vs. int conversion warningsSebastian Schuberth
2011-08-25Drop STRLEN() macrosKirill A. Shutemov
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-18posix: Properly handle `snprintf` in all platformsVicent Marti
2011-08-17git__strndup: immediately return NULL when ENOMEMschu
Signed-off-by: schu <schu-github@schulog.org>
2011-08-10util: Add git__strcmp_cb() wrappernulltoken
We don't want direct pointers to the CRT on Windows, we may get stdcall conflicts.
2011-07-09Remove unused methodsVicent Marti
The direct-writes commit left some (slow) internals methods that were no longer needed. These have been removed. Also, the Reflog code was using the old `git_signature__write`, so it has been rewritten to use a normal buffer and the new `writebuf` signature writer. It's now slightly simpler and faster.
2011-07-07Fix MSVC compilation warningsnulltoken
2011-07-07vector: Timsort all of the thingsVicent Marti
Drop the GLibc implementation of Merge Sort and replace it with Timsort. The algorithm has been tuned to work on arrays of pointers (void **), so there's no longer a need to abstract the byte-width of each element in the array. All the comparison callbacks now take pointers-to-elements, not pointers-to-pointers, so there's now one less level of dereferencing. E.g. int index_cmp(const void *a, const void *b) { - const git_index_entry *entry_a = *(const git_index_entry **)(a); + const git_index_entry *entry_a = (const git_index_entry *)(a); The result is up to a 40% speed-up when sorting vectors. Memory usage remains lineal. A new `bsearch` implementation has been added, whose callback also supplies pointer-to-elements, to uniform the Vector API again.
2011-07-05util: introduce merge sort routineKirill A. Shutemov
In some cases it's important to preserve order of elements with equal keys (stable sort). qsort(3) doesn't define order of elements with equal keys. git__msort() implements merge sort which is stable sort. Implementation taken from git. Function renamed git_qsort() -> git__msort(). Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-05Merge pull request #300 from carlosmn/gsoc2011/masterVicent Martí
A bit of networking
2011-07-05fileops: CleanupVicent Marti
Cleaned up the structure of the whole OS-abstraction layer. fileops.c now contains a set of utility methods for file management used by the library. These are abstractions on top of the original POSIX calls. There's a new file called `posix.c` that contains emulations/reimplementations of all the POSIX calls the library uses. These are prefixed with `p_`. There's a specific posix file for each platform (win32 and unix). All the path-related methods have been moved from `utils.c` to `path.c` and have their own prefix.
2011-07-01cleanup: remove trailing spacesKirill A. Shutemov
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-06-26pkt-line: read capabilitiesCarlos Martín Nieto
Try to read the server capabilities and add them to the git_pkt_ref struct. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-06-26Add git.git's fnmatch, which is really GNU's and the git__fnmatch wrapperCarlos Martín Nieto
If the strings match, git__fnmatch returns GIT_SUCCESS and GIT_ENOMATCH on failure to match. MSVC fixes: Added a test for _MSC_VER and (in that case) defined HAVE_STRING_H to 1 so it doesn't try to include <strings.h> which doesn't exist in the MSVC world. Moved the function declarations to use the modern inline ones so MSVC doesn't have a fit. Added casts everywhere so MSVC doesn't crap its pants. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-06-18Fix compilation error in MSVC when compiling for c++Johan 't Hart
2011-06-03odb: Fix loading ODB alternatesVicent Marti
Fixed an issue with the `strtokz implementation and added support for comments and relative paths in the alternates file.
2011-05-17utils: Move git__str[n]tolowerVicent Marti
2011-05-17utils: Implement git__strndupVicent Marti
2011-05-09Change error handling mechanism once againVicent Marti
Ok, this is the real deal. Hopefully. Here's how it's going to work: - One main method, called `git__throw`, that sets the error code and error message when an error happens. This method must be called in every single place where an error code was being returned previously, setting an error message instead. Example, instead of: return GIT_EOBJCORRUPTED; Use: return git__throw(GIT_EOBJCORRUPTED, "The object is missing a finalizing line feed"); And instead of: [...] { error = GIT_EOBJCORRUPTED; goto cleanup; } Use: [...] { error = git__throw(GIT_EOBJCORRUPTED, "What an error!"); goto cleanup; } The **only** exception to this are the allocation methods, which return NULL on failure but already set the message manually. /* only place where an error code can be returned directly, because the error message has already been set by the wrapper */ if (foo == NULL) return GIT_ENOMEM; - One secondary method, called `git__rethrow`, which can be used to fine-grain an error message and build an error stack. Example, instead of: if ((error = foobar(baz)) < GIT_SUCCESS) return error; You can now do: if ((error = foobar(baz)) < GIT_SUCCESS) return git__rethrow(error, "Failed to do a major operation"); The return of the `git_lasterror` method will be a string in the shape of: "Failed to do a major operation. (Failed to do an internal operation)" E.g. "Failed to open the index. (Not enough permissions to access '/path/to/index')." NOTE: do not abuse this method. Try to write all `git__throw` messages in a descriptive manner, to avoid having to rethrow them to clarify their meaning. This method should only be used in the places where the original error message set by a subroutine is not specific enough. It is encouraged to continue using this style as much possible to enforce error propagation: if ((error = foobar(baz)) < GIT_SUCCESS) return error; /* `foobar` has set an error message, and we are just propagating it */ The error handling revamp will take place in two phases: - Phase 1: Replace all pieces of code that return direct error codes with calls to `git__throw`. This can be done semi-automatically using `ack` to locate all the error codes that must be replaced. - Phase 2: Add some `git__rethrow` calls in those cases where the original error messages are not specific enough. Phase 1 is the main goal. A minor libgit2 release will be shipped once Phase 1 is ready, and the work will start on gradually improving the error handling mechanism by refining specific error messages. OTHER NOTES: - When writing error messages, please refrain from using weasel words. They add verbosity to the message without giving any real information. (<3 Emeric) E.g. "The reference file appears to be missing a carriage return" Nope. "The reference file is missing a carriage return" Yes. - When calling `git__throw`, please try to use more generic error codes so we can eventually reduce the list of error codes to something more reasonable. Feel free to add new, more generic error codes if these are going to replace several of the old ones. E.g. return GIT_EREFCORRUPTED; Can be turned into: return git__throw(GIT_EOBJCORRUPTED, "The reference is corrupted");
2011-05-09errors: Set error messages on memory allocationVicent Marti
2011-04-10Properly check `strtol` for errorsVicent Marti
We are now using a custom `strtol` implementation to make sure we're not missing any overflow errors.
2011-04-03New external API method: `git_tree_create`Sarath Lakshman
Creates a tree by scanning the index file. The method handles recursive creation of trees for subdirectories and adds them to the parent tree.
2011-03-20I broke your bindingsVicent Marti
Hey. Apologies in advance -- I broke your bindings. This is a major commit that includes a long-overdue redesign of the whole object-database structure. This is expected to be the last major external API redesign of the library until the first non-alpha release. Please get your bindings up to date with these changes. They will be included in the next minor release. Sorry again! Major features include: - Real caching and refcounting on parsed objects - Real caching and refcounting on objects read from the ODB - Streaming writes & reads from the ODB - Single-method writes for all object types - The external API is now partially thread-safe The speed increases are significant in all aspects, specially when reading an object several times from the ODB (revwalking) and when writing big objects to the ODB. Here's a full changelog for the external API: blob.h ------ - Remove `git_blob_new` - Remove `git_blob_set_rawcontent` - Remove `git_blob_set_rawcontent_fromfile` - Rename `git_blob_writefile` -> `git_blob_create_fromfile` - Change `git_blob_create_fromfile`: The `path` argument is now relative to the repository's working dir - Add `git_blob_create_frombuffer` commit.h -------- - Remove `git_commit_new` - Remove `git_commit_add_parent` - Remove `git_commit_set_message` - Remove `git_commit_set_committer` - Remove `git_commit_set_author` - Remove `git_commit_set_tree` - Add `git_commit_create` - Add `git_commit_create_v` - Add `git_commit_create_o` - Add `git_commit_create_ov` tag.h ----- - Remove `git_tag_new` - Remove `git_tag_set_target` - Remove `git_tag_set_name` - Remove `git_tag_set_tagger` - Remove `git_tag_set_message` - Add `git_tag_create` - Add `git_tag_create_o` tree.h ------ - Change `git_tree_entry_2object`: New signature is `(git_object **object_out, git_repository *repo, git_tree_entry *entry)` - Remove `git_tree_new` - Remove `git_tree_add_entry` - Remove `git_tree_remove_entry_byindex` - Remove `git_tree_remove_entry_byname` - Remove `git_tree_clearentries` - Remove `git_tree_entry_set_id` - Remove `git_tree_entry_set_name` - Remove `git_tree_entry_set_attributes` object.h ------------ - Remove `git_object_new - Remove `git_object_write` - Change `git_object_close`: This method is now *mandatory*. Not closing an object causes a memory leak. odb.h ----- - Remove type `git_rawobj` - Remove `git_rawobj_close` - Rename `git_rawobj_hash` -> `git_odb_hash` - Change `git_odb_hash`: New signature is `(git_oid *id, const void *data, size_t len, git_otype type)` - Add type `git_odb_object` - Add `git_odb_object_close` - Change `git_odb_read`: New signature is `(git_odb_object **out, git_odb *db, const git_oid *id)` - Change `git_odb_read_header`: New signature is `(size_t *len_p, git_otype *type_p, git_odb *db, const git_oid *id)` - Remove `git_odb_write` - Add `git_odb_open_wstream` - Add `git_odb_open_rstream` odb_backend.h ------------- - Change type `git_odb_backend`: New internal signatures are as follows int (* read)(void **, size_t *, git_otype *, struct git_odb_backend *, const git_oid *) int (* read_header)(size_t *, git_otype *, struct git_odb_backend *, const git_oid *) int (* writestream)(struct git_odb_stream **, struct git_odb_backend *, size_t, git_otype) int (* readstream)( struct git_odb_stream **, struct git_odb_backend *, const git_oid *) - Add type `git_odb_stream` - Add enum `git_odb_streammode` Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-15Rewrite the Pack backendVicent Marti
The new pack backend is an adaptation of the original git.git code in `sha1_file.c`. It's slightly faster than the previous version and severely less memory-hungry. The call-stack of a normal pack backend query has been properly documented in the top of the header for future reference. And by properly I mean with ASCII diagrams 'n shit.
2011-03-15Rewrite the Revision WalkerVicent Marti
The new revision walker uses an internal Commit object storage system, custom memory allocator and much improved topological and time sorting algorithms. It's about 20x times faster than the previous implementation when browsing big repositories. The following external API calls have changed: `git_revwalk_next` returns an OID instead of a full commit object. The initial call to `git_revwalk_next` is no longer blocking when iterating through a repo with a time-sorting mode. Iterating with Topological or inverted modes still makes the initial call blocking to preprocess the commit list, but this block should be mostly unnoticeable on most repositories (topological preprocessing times at 0.3s on the git.git repo). `git_revwalk_push` and `git_revwalk_hide` now take an OID instead of a full commit object.
2011-02-09Use the new git__joinpath to build paths in methodsVicent Marti
The `git__joinpath` function has been changed to use a statically allocated buffer; we assume the buffer to be 4096 bytes, because fuck you. The new method also supports an arbritrary number of paths to join, which may come in handy in the future. Some methods which were manually joining paths with `strcpy` now use the new function, namely those in `index.c` and `refs.c`. Based on Emeric Fermas' original patch, which was using the old `git__joinpath` because I'm stupid. Thanks! Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-02-05Add new utility method `git__joinpath`Vicent Marti
Signed-off-by: Vicent Marti <tanoku@gmail.com>