summaryrefslogtreecommitdiff
path: root/src/revwalk.c
Commit message (Collapse)AuthorAgeFilesLines
* revwalk: more sensible array handlingcmn/revwalk-array-fixCarlos Martín Nieto2014-06-111-2/+2
| | | | | | | | | Instead of using a sentinel empty value to detect the last commit, let's check for when we get a NULL from popping the stack, which lets us know when we're done. The current code causes us to read uninitialized data, although only on RHEL/CentOS 6 in release mode. This is a readability win overall.
* No need to find merge base.Anurag Gupta2014-03-311-35/+17
|
* Conforming to libgit2 coding style.Anurag Gupta2014-03-241-4/+1
|
* Remove unused push_cb_dataAnurag Gupta2014-03-241-5/+0
|
* Callback to hide commits in revision walker.Anurag Gupta2014-03-241-0/+28
|
* revwalk: don't try to find merge bases when there can be noneCarlos Martín Nieto2014-03-201-4/+14
| | | | | | | | | | | | | | | | | | | As a way to speed up the cases where we need to hide some commits, we find out what the merge bases are so we know to stop marking commits as uninteresting and avoid walking down a potentially very large amount of commits which we will never see. There are however two oversights in current code. The merge-base finding algorithm fails to recognize that if it is only given one commit, there can be no merge base. It instead walks down the whole ancestor chain needlessly. Make it return an empty list immediately in this situation. The revwalk does not know whether the user has asked to hide any commits at all. In situation where the user pushes multiple commits but doesn't hide any, the above fix wouldn't do the trick. Keep track of whether the user wants to hide any commits and only run the merge-base finding algorithm when it's needed.
* Merge pull request #2100 from libgit2/rb/update-pqueueVicent Marti2014-02-071-1/+2
|\ | | | | Replace priority queue code with implementation from hashsig
| * Convert pqueue to just be a git_vectorRussell Belfer2014-02-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This updates the git_pqueue to simply be a set of specialized init/insert/pop functions on a git_vector. To preserve the pqueue feature of having a fixed size heap, I converted the "sorted" field in git_vectors to a more general "flags" field so that pqueue could mix in it's own flag. This had a bunch of ramifications because a number of places were directly looking at the vector "sorted" field - I added a couple new git_vector helpers (is_sorted, set_sorted) so the specific representation of this information could be abstracted.
| * Replace pqueue with code from hashsig heapRussell Belfer2014-02-031-2/+3
| | | | | | | | | | | | | | | | | | | | | | I accidentally wrote a separate priority queue implementation when I was working on file rename detection as part of the file hash signature calculation code. To simplify licensing terms, I just adapted that to a general purpose priority queue and replace the old priority queue implementation that was borrowed from elsewhere. This also removes parts of the COPYING document that no longer apply to libgit2.
* | revwalk: remove usage of foreachCarlos Martín Nieto2014-02-051-11/+14
| |
* | revwalk: ignore wrong object type in glob pushesCarlos Martín Nieto2014-02-051-12/+16
| | | | | | | | | | Pushing a whole namespace can cause us to attempt to push non-committish objects. Catch this situation and special-case it for ignoring this.
* | revwalk: accept committish objectsCarlos Martín Nieto2014-02-051-8/+13
|/ | | | | | | | | | | Let the user push committish objects and peel them to figure out which commit to push to our queue. This is for convenience and for allowing uses of git_revwalk_push_glob(w, "tags") with annotated tags.
* Remove converting user error to GIT_EUSERRussell Belfer2013-12-111-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the behavior of callbacks so that the callback error code is not converted into GIT_EUSER and instead we propagate the return value through to the caller. Instead of using the giterr_capture and giterr_restore functions, we now rely on all functions to pass back the return value from a callback. To avoid having a return value with no error message, the user can call the public giterr_set_str or some such function to set an error message. There is a new helper 'giterr_set_callback' that functions can invoke after making a callback which ensures that some error message was set in case the callback did not set one. In places where the sign of the callback return value is meaningful (e.g. positive to skip, negative to abort), only the negative values are returned back to the caller, obviously, since the other values allow for continuing the loop. The hardest parts of this were in the checkout code where positive return values were overloaded as meaningful values for checkout. I fixed this by adding an output parameter to many of the internal checkout functions and removing the overload. This added some code, but it is probably a better implementation. There is some funkiness in the network code where user provided callbacks could be returning a positive or a negative value and we want to rely on that to cancel the loop. There are still a couple places where an user error might get turned into GIT_EUSER there, I think, though none exercised by the tests.
* Further EUSER and error propagation fixesRussell Belfer2013-12-111-8/+13
| | | | | | | | | | | | | This continues auditing all the places where GIT_EUSER is being returned and making sure to clear any existing error using the new giterr_user_cancel helper. As a result, places that relied on intercepting GIT_EUSER but having the old error preserved also needed to be cleaned up to correctly stash and then retrieve the actual error. Additionally, as I encountered places where error codes were not being propagated correctly, I tried to fix them up. A number of those fixes are included in the this commit as well.
* Remove regex usage from places that don't need itRussell Belfer2013-09-231-29/+14
| | | | | | | | | | | In revwalk, we are doing a very simple check to see if a string contains wildcard characters, so a full regular expression match is not needed. In remote listing, now that we have git_config_foreach_match with full regular expression matching, we can take advantage of that and eliminate the regex here, replacing it with much simpler string manipulation.
* revwalk: allow simplifying by first-parentCarlos Martín Nieto2013-09-091-4/+18
| | | | | When enabled, only the first parent of each commit will be queued, enabling a simple way of using first-parent simplification.
* revwalk: make mark_unintersting use a loopCarlos Martín Nieto2013-09-061-10/+32
| | | | | | | Using a recursive function can blow the stack when dealing with long histories. Use a loop instead to limit the call chain depth. This fixes #1223.
* refs: remove the OID/SYMBOLIC filteringCarlos Martín Nieto2013-05-111-1/+1
| | | | | | | | | Nobody should ever be using anything other than ALL at this level, so remove the option altogether. As part of this, git_reference_foreach_glob is now implemented in the frontend using an iterator. Backends will later regain the ability of doing the glob filtering in the backend.
* git_revision -> git_revspecVicent Marti2013-04-151-7/+7
|
* Is this crazy?Vicent Marti2013-04-151-9/+10
|
* Change git_revparse to output git_object pointersBen Straub2013-04-151-3/+5
| | | | This will probably prevent many lookup/free operations in calling code.
* Deprecate git_revparse_single and _rangelikeBen Straub2013-04-091-8/+6
|
* revwalk: Parse revision rangesGreg Price2013-04-061-0/+25
| | | | | | All the hard work is already in revparse. Signed-off-by: Greg Price <price@mit.edu>
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Fix function name and add real error checkRussell Belfer2012-11-291-2/+3
| | | | | | | `revwalk.h:commit_lookup()` -> `git_revwalk__commit_lookup()` and make `git_commit_list_parse()` do real error checking that the item in the list is an actual commit object. Also fixed an apparent typo in a test name.
* Move merge functions to merge.cBen Straub2012-11-271-467/+38
| | | | | In so doing, promote commit_list to git_commit_list, with its own internal API header.
* Rename ref and reflog apis for consistencyBen Straub2012-11-271-1/+1
|
* revwalk: fix off-by-one errorMichael Schubert2012-09-271-1/+2
| | | | Fixes #921.
* git_mergebase: Constness-Fix for consistencySascha Cunz2012-09-091-1/+1
|
* Diff iteratorsRussell Belfer2012-09-051-11/+19
| | | | | | | | | | | This refactors the diff output code so that an iterator object can be used to traverse and generate the diffs, instead of just the `foreach()` style with callbacks. The code has been rearranged so that the two styles can still share most functions. This also replaces `GIT_REVWALKOVER` with `GIT_ITEROVER` and uses that as a common error code for marking the end of iteration when using a iterator style of object.
* revwalk: refuse push of non-commit objectsMichael Schubert2012-08-271-6/+14
| | | | | Check the type of the pushed object immediately instead of starting the walk and failing in between.
* revwalk: relax the parsing of the commit timenulltoken2012-07-111-7/+24
|
* revwalk: make git_revwalk_(push|hide)_glob() leverage ↵nulltoken2012-06-221-8/+3
| | | | git_reference_foreach_glob()
* Merge pull request #753 from nulltoken/topic/merge-base-manyVicent Martí2012-06-181-0/+56
|\ | | | | Expose git_merge_base_many()
| * merge: Expose git_merge_base_many()nulltoken2012-06-071-0/+56
| |
* | Fix fragile commit parsing in revwalkRussell Belfer2012-06-111-15/+21
|/
* errors: Rename error codesbreaking-changesVicent Martí2012-05-181-1/+1
|
* errors: Rename the generic return codesVicent Martí2012-05-181-11/+11
|
* really reset walker with git_revwalk_resetNico von Geyso2012-05-151-0/+3
| | | | | | | | From the description of git_revwalk_reset in revwalk.h the function should clear all pushed and hidden commits, and leave the walker in a blank state (just like at creation). Apparently everything gets reseted appart of pushed commits (walk->one and walk->twos) This fix should reset the walker properly.
* Remove old and unused error codesVicent Martí2012-05-021-1/+1
|
* Fix Win32 warningsRussell Belfer2012-04-261-1/+1
|
* Merge pull request #642 from arrbee/mem-poolsRussell Belfer2012-04-251-73/+32
|\ | | | | Memory pools and khash hashtables
| * Rename git_khash_str to git_strmap, etc.Russell Belfer2012-04-251-5/+5
| | | | | | | | | | | | This renamed `git_khash_str` to `git_strmap`, `git_hash_oid` to `git_oidmap`, and deletes `git_hashtable` from the tree, plus adds unit tests for `git_strmap`.
| * Convert hashtable usage over to khashRussell Belfer2012-04-251-21/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This updates khash.h with some extra features (like error checking on allocations, ability to use wrapped malloc, foreach calls, etc), creates two high-level wrappers around khash: `git_khash_str` and `git_khash_oid` for string-to-void-ptr and oid-to-void-ptr tables, then converts all of the old usage of `git_hashtable` over to use these new hashtables. For `git_khash_str`, I've tried to create a set of macros that yield an API not too unlike the old `git_hashtable` API. Since the oid hashtable is only used in one file, I haven't bother to set up all those macros and just use the khash APIs directly for now.
| * Convert revwalk to use git_poolRussell Belfer2012-04-251-53/+16
| | | | | | | | | | This removes the custom paged allocator from revwalk and replaces it with a `git_pool`.
* | revwalk: return GIT_EREVWALKER earlier if no references were pushedCarlos Martín Nieto2012-04-251-0/+7
|/ | | | | In the case that walk->one is NULL, we know that we have no positive references, so we already know that the revwalk is over.
* Rename to git_reference_name_to_oidRussell Belfer2012-04-231-1/+1
|
* Fix warnings on 64-bit windows buildsRussell Belfer2012-04-171-39/+36
| | | | | This fixes all the warnings on win64 except those in deps, which come from the regex code.
* Add git_reference_lookup_oid and lookup_resolvedRussell Belfer2012-04-171-12/+3
| | | | | | | | | | | | | | Adds a new public reference function `git_reference_lookup_oid` that directly resolved a reference name to an OID without returning the intermediate `git_reference` object (hence, no free needed). Internally, this adds a `git_reference_lookup_resolved` function that combines looking up and resolving a reference. This allows us to be more efficient with memory reallocation. The existing `git_reference_lookup` and `git_reference_resolve` are reimplmented on top of the new utility and a few places in the code are changed to use one of the two new functions.
* error-handling: revwalkCarlos Martín Nieto2012-04-121-100/+104
|