summaryrefslogtreecommitdiff
path: root/include/git2/tree.h
Commit message (Collapse)AuthorAgeFilesLines
* Introduce a function to create a tree based on a different onecmn/tree-updateCarlos Martín Nieto2016-05-171-0/+46
| | | | | | | | | | | Instead of going through the usual steps of reading a tree recursively into an index, modifying it and writing it back out as a tree, introduce a function to perform simple updates more efficiently. `git_tree_create_updated` avoids reading trees which are not modified and supports upsert and delete operations. It is not as versatile as modifying the index, but it makes some common operations much more efficient.
* git_object_dup: introduce typesafe versionsEdward Thomson2016-03-231-0/+9
|
* treebuilder: rename _create() to _new()cmn/treebuilder-newCarlos Martín Nieto2014-12-271-1/+1
| | | | | | This function is a constructor, so let's name it like one and leave _create() for the reference functions, which do create/write the reference.
* treebuilder: take a repository for path validationEdward Thomson2014-12-171-3/+3
| | | | | | Path validation may be influenced by `core.protectHFS` and `core.protectNTFS` configuration settings, thus treebuilders can take a repository to influence their configuration.
* treebuilder: don't keep removed entries aroundCarlos Martín Nieto2014-06-101-3/+5
| | | | | | If the user wants to keep a copy for themselves, they should make a copy. It adds unnecessary complexity to make sure the returned entries are valid until the builder is cleared.
* treebuilder: use a map instead of vector to store the entriesCarlos Martín Nieto2014-06-101-1/+1
| | | | | | | | | | | | | | | | | Finding a filename in a vector means we need to resort it every time we want to read from it, which includes every time we want to write to it as well, as we want to find duplicate keys. A hash-map fits what we want to do much more accurately, as we do not care about sorting, but just the particular filename. We still keep removed entries around, as the interface let you assume they were going to be around until the treebuilder is cleared or freed, but in this case that involves an append to a vector in the filter case, which can now fail. The only time we care about sorting is when we write out the tree, so let's make that the only time we do any sorting.
* Fixed miscellaneous documentation errors.Michael Anderson2014-05-231-1/+1
|
* tree: remove legacy 'oid' namingCarlos Martín Nieto2014-01-251-3/+3
| | | | Rename git_tree_entry_byoid() to _byid() as per the convention.
* Align git_tree_entry_dup.Arthur Schreiber2014-01-141-3/+4
|
* Add git_treebuilder_insert test and clarify docRussell Belfer2013-12-121-2/+9
| | | | | | This wasn't being tested and since it has a callback, I fixed it even though the return value of this callback is not treated like any of the other callbacks in the API.
* tree: allow retrieval of raw attributesCarlos Martín Nieto2013-10-081-0/+11
| | | | | | When a tool needs to recreate the tree object (for example an interface to another VCS), it needs to use the raw attributes, forgoing any normalization.
* Small grammar fix in docsAndy Lindeman2013-07-151-1/+1
|
* Fixed most documentation header bugsAndreas Linde2013-06-241-4/+4
| | | | | | | | | | | Fixed a few header @param and @return typos with the help of -Wdocumentation in Xcode. The following warnings have not been fixed: common.h:213 - Not sure how the documentation format is for '...' notes.h:102 - Correct @param name but empty text notes.h:111 - Correct @param name but empty text pack.h:140 - @return missing text pack.h:148 - @return missing text
* Add cat-file example and increase const use in APIRussell Belfer2013-05-161-3/+3
| | | | | | | | | | | | | | | | This adds an example implementation that emulates git cat-file. It is a convenient and relatively simple example of getting data out of a repository. Implementing this also revealed that there are a number of APIs that are still not using const pointers to objects that really ought to be. The main cause of this is that `git_vector_bsearch` may need to call `git_vector_sort` before doing the search, so a const pointer to the vector is not allowed. However, for tree objects, with a little care, we can ensure that the vector of tree entries is always sorted and allow lookups to take a const pointer. Also, the missing const in commit objects just looks like an oversight.
* Standardize cast versions of git_object accessorsRussell Belfer2013-04-291-15/+5
| | | | | | This removes the GIT_INLINE versions of the simple git_object accessors and standardizes them with a helper macro in src/object.h to build the function bodies.
* Added git_treebuilder_entrycountJohn Wiegley2013-01-281-0/+8
| | | | | Conflicts: src/tree.c
* Add git_tree_entry_cmp and git_tree_entry_icmpRussell Belfer2013-01-151-0/+9
| | | | | | | 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
|
* Clean up iterator APIsRussell Belfer2012-12-101-0/+8
| | | | | | | | 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.
* Fix up some missing consts in tree & indexRussell Belfer2012-11-271-10/+7
| | | | | | | | | | | | | 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-1/+1
|
* API review / update for tree.hRussell Belfer2012-11-271-92/+117
|
* index: Add git_index_write_treeVicent Marti2012-11-011-18/+0
|
* Add complex checkout test and then fix checkoutRussell Belfer2012-10-091-2/+2
| | | | | | | | | | | | | | | | 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-2/+2
|
* treebuilder: enhance attributes handling on insertionnulltoken2012-08-191-1/+7
|
* tree: allow the user to skip an entry or cancel the walkCarlos Martín Nieto2012-08-131-2/+3
| | | | | | | | | 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.
* Merge remote-tracking branch 'arrbee/tree-walk-fixes' into developmentVicent Marti2012-08-061-0/+11
|\ | | | | | | | | | | | | | | | | Conflicts: src/notes.c src/transports/git.c src/transports/http.c src/transports/local.c tests-clar/odb/foreach.c
| * Fix git_tree_walk to return user errorRussell Belfer2012-07-261-0/+11
| | | | | | | | | | | | | | | | | | | | | | 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-2/+2
|/
* 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-14/+53
| | | | Smaller, simpler, faster.
* Fix spelling errors.Bruce Mitchener2012-05-191-2/+2
|
* errors: Rename error codesbreaking-changesVicent Martí2012-05-181-1/+1
|
* errors: Rename the generic return codesVicent Martí2012-05-181-9/+8
|
* tree: Naming conventionsVicent Martí2012-05-161-1/+1
|
* tree: Kill the `git_tree_diff` functionsVicent Martí2012-05-161-34/+0
| | | | These are deprecated and replaced with the diffing code in git2/diff.h
* Add missing GIT_EXTERN declarationsSascha Cunz2012-05-141-2/+2
|
* Revert GIT_STATUS constants to avoid issuesRussell Belfer2012-03-021-6/+0
| | | | | | | | | This reverts the changes to the GIT_STATUS constants and adds a new enumeration to describe the type of change in a git_diff_delta. I don't love this solution, but it should prevent strange errors from occurring for now. Eventually, I would like to unify the various status constants, but it needs a larger plan and I just wanted to eliminate this breakage quickly.
* Clean up diff implementation for reviewRussell Belfer2012-03-021-4/+5
| | | | | | | This fixes several bugs, updates tests and docs, eliminates the FILE* assumption in favor of printing callbacks for the diff patch formatter helpers, and adds a "diff" example function that can perform a diff from the command line.
* Implement diff lists and formattersRussell Belfer2012-03-021-0/+5
| | | | | | | | This reworks the diff API to separate the steps of producing a diff descriptions from formatting the diff. This will allow us to share diff output code with the various diff creation scenarios and will allow us to implement rename detection as an optional pass that can be run on a diff list.
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* tree: recursive diff-indexVicent Marti2011-12-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk> Signed-off-by: Vicent Marti <tanoku@gmail.com> # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # Author: Carlos Martín Nieto <carlos@cmartin.tk> # # On branch development # Your branch is ahead of 'origin/development' by 11 commits. # # Changes to be committed: # (use "git reset HEAD^1 <file>..." to unstage) # # modified: include/git2/tree.h # modified: src/tree.c # modified: tests-clay/clay_main.c # modified: tests-clay/object/tree/diff.c # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # 0001-remote-Cleanup-the-remotes-code.patch # 466.patch # 466.patch.1 # 488.patch # Makefile # libgit2.0.15.0.dylib # libgit2.0.dylib # libgit2.dylib # libgit2_clay # libgit2_test # tests-clay/object/tree/
* tree: implement tree diffingCarlos Martín Nieto2011-12-031-0/+34
| | | | | | | | For each difference in the trees, the callback gets called with the relevant information so the user can fill in their own data structures. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Rename all `_close` methodsVicent Marti2011-11-261-4/+4
| | | | | There's no difference between `_free` and `_close` semantics: keep everything with the same name to avoid confusions.
* tree: Fix documentationVicent Marti2011-11-221-1/+2
|
* tree: Add payload to `git_tree_walk`Vicent Marti2011-11-181-2/+2
|
* Rename `git_tree_frompath` to `git_tree_get_subtree`Vicent Marti2011-11-181-7/+7
| | | | That makes more sense to me.
* tree: Add traversal in post-orderVicent Marti2011-10-271-0/+30
|