summaryrefslogtreecommitdiff
path: root/src/tree.c
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
|
* tree: Kill the `git_tree_diff` functionsVicent Martí2012-05-161-270/+0
| | | | These are deprecated and replaced with the diffing code in git2/diff.h
* Ranged iterators and rewritten git_status_fileRussell Belfer2012-05-151-0/+27
| | | | | | | | | | | | | | | | | | | | | The goal of this work is to rewrite git_status_file to use the same underlying code as git_status_foreach. This is done in 3 phases: 1. Extend iterators to allow ranged iteration with start and end prefixes for the range of file names to be covered. 2. Improve diff so that when there is a pathspec and there is a common non-wildcard prefix of the pathspec, it will use ranged iterators to minimize excess iteration. 3. Rewrite git_status_file to call git_status_foreach_ext with a pathspec that covers just the one file being checked. Since ranged iterators underlie the status & diff implementation, this is actually fairly efficient. The workdir iterator does end up loading the contents of all the directories down to the single file, which should ideally be avoided, but it is pretty good.
* Remove old and unused error codesVicent Martí2012-05-021-1/+1
|
* Merge branch 'new-error-handling' into developmentVicent Martí2012-05-021-151/+136
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .travis.yml include/git2/diff.h src/config_file.c src/diff.c src/diff_output.c src/mwindow.c src/path.c tests-clar/clar_helpers.c tests-clar/object/tree/frompath.c tests/t00-core.c tests/t03-objwrite.c tests/t08-tag.c tests/t10-refs.c tests/t12-repo.c tests/t18-status.c tests/test_helpers.c tests/test_main.c
| * Merge remote-tracking branch 'carlosmn/remaining-errors' into new-error-handlingVicent Martí2012-05-011-148/+132
| |\ | | | | | | | | | | | | Conflicts: src/refspec.c
| | * error handling: move the missing parts over to the new error handlingCarlos Martín Nieto2012-04-261-148/+132
| | |
| * | buf: deploy git_buf_len()nulltoken2012-04-301-1/+1
| |/
| * Fix warnings on 64-bit windows buildsRussell Belfer2012-04-171-1/+1
| | | | | | | | | | This fixes all the warnings on win64 except those in deps, which come from the regex code.
| * error-handling: RepositoryVicent Martí2012-03-071-4/+5
| | | | | | | | | | | | | | | | 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.
* | tree: Fix homing entry searchVicent Martí2012-03-281-2/+2
|/
* tree: break out on write errorCarlos Martín Nieto2012-02-231-0/+1
| | | | | If write_tree() returs an error, we used to set the error message and continued looping. Exit the loop so we return the error.
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* treebuilder: remove needless variable entry_countschu2012-02-051-8/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* diff-index: fix leakCarlos Martín Nieto2012-01-191-0/+1
| | | | The buffer wasn't getting freed if the last difference was a deletion.
* Move path related functions from fileops to pathRussell Belfer2012-01-171-1/+1
| | | | | | | | | | | This takes all of the functions that look up simple data about paths (such as `git_futils_isdir`) and moves them over to path.h (becoming `git_path_isdir`). This leaves fileops.h just with functions that actually manipulate the filesystem or look at the file contents in some way. As part of this, the dir.h header which is really just for win32 support was moved into win32 (with some minor changes).
* do not use full path in diff-indexClemens Buchacher2011-12-301-10/+15
| | | | | | | | | | Currently, diff_index passes the full relative path from the repository root to the callback. In case of an addition, it passes the tree entry instead of the index entry. This change fixes the path used for addition, and it passes only the basename of the path. This mimics the current behavior of git_tree_diff.
* move entry_is_tree to tree.hClemens Buchacher2011-12-301-6/+4
|
* Fix tree-diff with the new path APIVicent Marti2011-12-141-2/+2
|
* Merge remote-tracking branch 'arrbee/git-buf-for-paths' into developmentVicent Marti2011-12-091-34/+46
|\ | | | | | | | | Conflicts: tests-clay/clay_main.c
| * Use git_buf for path storage instead of stack-based buffersRussell Belfer2011-12-071-34/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This converts virtually all of the places that allocate GIT_PATH_MAX buffers on the stack for manipulating paths to use git_buf objects instead. The patch is pretty careful not to touch the public API for libgit2, so there are a few places that still use GIT_PATH_MAX. This extends and changes some details of the git_buf implementation to add a couple of extra functions and to make error handling easier. This includes serious alterations to all the path.c functions, and several of the fileops.c ones, too. Also, there are a number of new functions that parallel existing ones except that use a git_buf instead of a stack-based buffer (such as git_config_find_global_r that exists alongsize git_config_find_global). This also modifies the win32 version of p_realpath to allocate whatever buffer size is needed to accommodate the realpath instead of hardcoding a GIT_PATH_MAX limit, but that change needs to be tested still.
* | tree: recursive diff-indexVicent Marti2011-12-031-0/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+174
|/ | | | | | | | 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-2/+2
| | | | | There's no difference between `_free` and `_close` semantics: keep everything with the same name to avoid confusions.
* repository: Change ownership semanticsVicent Marti2011-11-261-7/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* tree: Add payload to `git_tree_walk`Vicent Marti2011-11-181-5/+9
|
* Rename `git_tree_frompath` to `git_tree_get_subtree`Vicent Marti2011-11-181-14/+42
| | | | That makes more sense to me.
* global: Properly use `git__` memory wrappersVicent Marti2011-10-281-8/+8
| | | | | Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
* tree: Add traversal in post-orderVicent Marti2011-10-271-2/+54
|
* tree: Fix name lookups once and for allVicent Marti2011-10-201-45/+85
| | | | Double-pass binary search. Jeez.