summaryrefslogtreecommitdiff
path: root/src/graph.c
Commit message (Collapse)AuthorAgeFilesLines
* Make sure to always include "common.h" firstPatrick Steinhardt2017-07-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | Next to including several files, our "common.h" header also declares various macros which are then used throughout the project. As such, we have to make sure to always include this file first in all implementation files. Otherwise, we might encounter problems or even silent behavioural differences due to macros or defines not being defined as they should be. So in fact, our header and implementation files should make sure to always include "common.h" first. This commit does so by establishing a common include pattern. Header files inside of "src" will now always include "common.h" as its first other file, separated by a newline from all the other includes to make it stand out as special. There are two cases for the implementation files. If they do have a matching header file, they will always include this one first, leading to "common.h" being transitively included as first file. If they do not have a matching header file, they instead include "common.h" as first file themselves. This fixes the outlined problems and will become our standard practice for header and source files inside of the "src/" from now on.
* graph: flag fields should be declared as unsignedPatrick Steinhardt2016-12-121-1/+1
|
* graph: fix ahead-behind logiccmn/ahead-behind-orderCarlos Martín Nieto2014-08-281-2/+2
| | | | | | | | | | When we see PARENT1, it means there is a local commit and thus we are ahead. Likewise, seeing PARENT2 means that the upstream branch has a commit and we are one more behind. The logic is currently reversed. Correct it. This fixes #2501.
* graph: handle not finding a merge base gracefullyCarlos Martín Nieto2014-04-081-1/+6
| | | | | | | git_merge_base() returns GIT_ENOTFOUND when it cannot find a merge base. graph_desdendant_of() returns a boolean value (barring any errors), so it needs to catch the NOTFOUND return value and convert it into false, as not merge base means it cannot be a descendant.
* Correct grouping of parenthesesJacques Germishuys2014-04-081-1/+1
| | | | git_graph_descendant_of was returning the result of an assignment
* Replace pqueue with code from hashsig heapRussell Belfer2014-02-031-20/+15
| | | | | | | | | | | 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.
* Add `git_graph_descendant_of`.Arthur Schreiber2014-01-281-0/+14
|
* graph: make the ahead-behind docs clearerCarlos Martín Nieto2013-03-221-8/+8
| | | | | Explain it in local-upstream branch terms so it's easier to grasp than with the `one` and `two` naming from the merge-base code.
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Fix a bunch of leaks, error handling casescorrect-ahead-behindScott J. Goldman2012-12-091-12/+15
|
* Fix mark_parents() to account for bad luck traversalsScott J. Goldman2012-12-091-2/+18
| | | | | | | | | | | | | | | If commit timestamps are off, we're more likely to hit a traversal where the first path ends up traversing past the root commit of the tree. If that happens, it's possible that the loop will complete before the second path marks some of those final parents. This fix keeps track of the root nodes that are encountered in the traversal, and verify that they are properly marked. In the best case, with accurate timestamps, the traversal will continue to terminate when all the commits are STALE (parents of a merge-base), as it did before. In the worst case, where one path makes a complete traversal past a root commit, we will continue the loop until the root commit itself is marked.
* Morph copy of git_merge__bases_many() -> mark_parents()Scott J. Goldman2012-12-091-50/+15
| | | | Integrate mark_parents() with the ahead_behind() code.
* Copy git_merge__bases_many() for new ahead-behind codeScott J. Goldman2012-12-091-0/+96
| | | | | To be used as a basis for a function which marks nodes with parents up to the merge base.
* graph: plug leakCarlos Martín Nieto2012-11-301-2/+7
|
* Fix function name and add real error checkRussell Belfer2012-11-291-2/+2
| | | | | | | `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.
* graph.c: prune includesScott J. Goldman2012-11-281-7/+0
|
* Rename git_count_ahead_behind -> git_graph_ahead_behindScott J. Goldman2012-11-281-0/+100
Moved it into graph.{c,h} which i created for the new "graph" functions namespace. Also adjusted the function prototype to use `size_t` and `const git_oid *`.