summaryrefslogtreecommitdiff
path: root/src/tree.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Use git_odb_object_data/_size whereever possibleRussell Belfer2013-04-221-5/+9
| | | | | This uses the odb object accessors so we can change the internals more easily...
* What has science done.Vicent Marti2013-04-221-1/+3
|
* treebuilder: don't overwrite the error messageCarlos Martín Nieto2013-04-181-1/+0
|
* Improved tree iterator internalsRussell Belfer2013-03-141-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | This updates the tree iterator internals to be more efficient. The tree_iterator_entry objects are now kept as pointers that are allocated from a git_pool, so that we may use git__tsort_r for sorting (which is better than qsort, given that the tree is likely mostly ordered already). Those tree_iterator_entry objects now keep direct pointers to the data they refer to instead of keeping indirect index values. This simplifies a lot of the data structure traversal code. This also adds bsearch to find the start item position for range- limited tree iterators, and is more explicit about using git_path_cmp instead of reimplementing it. The git_path_cmp changed a bit to make it easier for tree_iterators to use it (but it was barely being used previously, so not a big deal). This adds a git_pool_free_array function that efficiently frees a list of pool allocated pointers (which the tree_iterator keeps). Also, added new tests for the git_pool free list functionality that was not previously being tested (or used).
* Rename function to __ prefixPhilip Kelley2013-03-011-3/+3
|
* Disable ignore_case when writing the index to a treePhilip Kelley2013-03-011-1/+15
|
* Some code cleanups in tree.cRussell Belfer2013-02-201-54/+44
| | | | | | | This replaces most of the explicit vector iteration with calls to git_vector_foreach, adds in some git__free and giterr_clear calls to clean up during some error paths, and a couple of other code simplifications.
* Store treebuilder length separately from entries vecRussell Belfer2013-02-201-3/+12
| | | | | | | The treebuilder entries vector flags removed items which means we can't rely on the entries vector length to accurately get the number of entries. This adds an entrycount value and maintains it while updating the treebuilder entries.
* Fix MSVC compilation warningsnulltoken2013-02-051-1/+1
| | | | Fix #1308
* Merge pull request #1285 from phkelley/vectorRussell Belfer2013-01-291-32/+38
|\ | | | | Vector improvements and their fallout
| * Vector improvements and their falloutPhilip Kelley2013-01-271-32/+38
| |
* | Added git_treebuilder_entrycountJohn Wiegley2013-01-281-0/+6
|/ | | | | Conflicts: src/tree.c
* Add git_tree_entry_cmp and git_tree_entry_icmpRussell Belfer2013-01-151-6/+15
| | | | | | | This adds a new external API git_tree_entry_cmp and a new internal API git_tree_entry_icmp for sorting tree entries. The case insensitive one is internal only because general users should never be seeing case-insensitively sorted trees.
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Fix iterator reset and add reset rangesRussell Belfer2012-12-101-0/+3
| | | | | | | The `git_iterator_reset` command has not been working in all cases particularly when there is a start and end range. This fixes it and adds tests for it, and also extends it with the ability to update the start/end range strings when an iterator is reset.
* Clean up iterator APIsRussell Belfer2012-12-101-2/+7
| | | | | | | | This removes the need to explicitly pass the repo into iterators where the repo is implied by the other parameters. This moves the repo to be owned by the parent struct. Also, this has some iterator related updates to the internal diff API to lay the groundwork for checkout improvements.
* tree: relax the filemode parserCarlos Martín Nieto2012-12-071-19/+26
| | | | | | | | | | | There are many different broken filemodes in the wild so we need to protect against them and give something useful up the chain. Don't fail when reading a tree from the ODB but normalize the mode as best we can. As 664 is no longer a mode that we consider to be valid and gets normalized to 644, we can stop accepting it in the treebuilder. The library won't expose it to the user, so any invalid modes are a bug.
* Merge pull request #1090 from arrbee/ignore-invalid-by-defaultVicent Martí2012-11-291-19/+23
|\ | | | | Ignore invalid entries by default
| * Minor optimization to tree entry validity checkRussell Belfer2012-11-191-19/+23
| | | | | | | | | | | | | | | | | | | | This checks for a leading '.' before looking for the invalid tree entry names. Even on pretty high levels of optimization, this seems to make a measurable improvement. I accidentally used && in the check initially instead of || and while debugging ended up improving the error reporting of issues with adding tree entries. I thought I'd leave those changes, too.
* | Fix warnings on Win64 buildRussell Belfer2012-11-271-11/+7
| |
* | Fix up some missing consts in tree & indexRussell Belfer2012-11-271-14/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | This fixes some missed places where we can apply const-ness to various public APIs. There are still some index and tree APIs that cannot take const pointers because we sort our `git_vectors` lazily and so we can't reliably bsearch the index and tree content without applying a `git_vector_sort()` first. This also fixes some missed places where size_t can be used and where const can be applied to a couple internal functions.
* | API updates for index.hBen Straub2012-11-271-4/+4
| |
* | API review / update for tree.hRussell Belfer2012-11-271-13/+21
|/
* Catch invalid filenames in append_entry()Scott J. Goldman2012-11-181-0/+3
| | | | | This prevents the index api from calling write_tree() with a bogus tree.
* Prevent creating `..`, `.`, and `.git` with tree builderScott J. Goldman2012-11-181-1/+3
| | | | As per core git.
* index: prevent tree creation from a non merged statenulltoken2012-11-091-0/+6
| | | | Fix libgit2/libgit2sharp#243
* index: Fix testsVicent Marti2012-11-011-1/+0
|
* index: Add git_index_write_treeVicent Marti2012-11-011-6/+2
|
* index refactoringEdward Thomson2012-10-291-2/+2
|
* Add complex checkout test and then fix checkoutRussell Belfer2012-10-091-3/+3
| | | | | | | | | | | | | | | | This started as a complex new test for checkout going through the "typechanges" test repository, but that revealed numerous issues with checkout, including: * complete failure with submodules * failure to create blobs with exec bits * problems when replacing a tree with a blob because the tree "example/" sorts after the blob "example" so the delete was being processed after the single file blob was created This fixes most of those problems and includes a number of other minor changes that made it easier to do that, including improving the TYPECHANGE support in diff/status, etc.
* tree entry: rename git_tree_entry_attributes() into git_tree_entry_filemode()nulltoken2012-08-211-2/+2
|
* filemode: deploy enum usagenulltoken2012-08-211-21/+21
|
* treebuilder: enhance attributes handling on insertionnulltoken2012-08-191-4/+26
|
* tree: allow the user to skip an entry or cancel the walkCarlos Martín Nieto2012-08-131-3/+8
| | | | | | | | | Returning a negative cancels the walk, and returning a positive one causes us to skip an entry, which was previously done by a negative value. This allows us to stay consistent with the rest of the functions that take a callback and keeps the skipping functionality.
* tree: bring back the documented behaviour for a walkCarlos Martín Nieto2012-08-131-4/+2
| | | | | However, there should be a way to cancel the walk and another to skip the entry.
* Merge remote-tracking branch 'arrbee/tree-walk-fixes' into developmentVicent Marti2012-08-061-8/+28
|\ | | | | | | | | | | | | | | | | Conflicts: src/notes.c src/transports/git.c src/transports/http.c src/transports/local.c tests-clar/odb/foreach.c
| * Add new iteration behavior to git_tree_walkRussell Belfer2012-08-031-4/+6
| | | | | | | | Missed this one, ironically enough.
| * Fix git_tree_walk to return user errorRussell Belfer2012-07-261-8/+26
| | | | | | | | | | | | | | | | | | | | | | This makes sure that an error code returned by the callback function of `git_tree_walk` will stop the iteration and get propagated back to the caller verbatim. Also, this adds a minor helper function `git_tree_entry_byoid` that searches a `git_tree` for an entry with the given OID. This isn't a fast function, but it's easier than writing the loop yourself as an external user of the library.
* | portability: Improve x86/amd64 compatibilitynulltoken2012-07-241-3/+3
|/
* tree: fix ordering for git_tree_walkMichael Schubert2012-07-191-8/+12
| | | | | | | | Josh Triplett noticed libgit2 actually does preorder entries in tree_walk_post instead of postorder. Also, we continued walking even when an error occured in the callback. Fix #773; also, allow both pre- and postorder walking.
* tree: unfound tree entry returns GIT_ENOTFOUNDnulltoken2012-07-121-1/+1
|
* tree: prevent git_tree_entry_free() from segfaulting when being passed a ↵nulltoken2012-07-121-0/+3
| | | | NULL tree_entry
* tree: Rename `entry_copy` to `entry_dup`tree-entry-by-pathVicent Marti2012-06-291-2/+2
|
* tree: Bring back `entry_bypath`Vicent Marti2012-06-291-100/+135
| | | | Smaller, simpler, faster.
* Merge remote-tracking branch 'yorah/fix/notes-creation' into developmentVicent Marti2012-06-191-0/+3
|\ | | | | | | | | Conflicts: src/notes.c
| * treebuilder: prevent git_treebuilder_free() from segfaulting when being ↵nulltoken2012-06-081-0/+3
| | | | | | | | passed a NULL treebuilder
* | misc: Fix warnings from PVS Studio trialVicent Martí2012-06-071-1/+1
|/
* errors: Rename error codesbreaking-changesVicent Martí2012-05-181-4/+4
|
* errors: Rename the generic return codesVicent Martí2012-05-181-7/+7
|
* tree: Naming conventionsVicent Martí2012-05-161-5/+8
|