Commit Graph

14 Commits

Author SHA1 Message Date
Carlos Martín Nieto
ce2e82694a graph: handle not finding a merge base gracefully
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.
2014-04-08 16:52:20 +02:00
Jacques Germishuys
56f8e06e49 Correct grouping of parentheses
git_graph_descendant_of was returning the result of an assignment
2014-04-08 16:30:26 +02:00
Russell Belfer
4075e060b4 Replace pqueue with code from hashsig heap
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.
2014-02-03 21:02:08 -08:00
Arthur Schreiber
e7c16943f4 Add git_graph_descendant_of. 2014-01-28 19:39:14 +01:00
Carlos Martín Nieto
33a59401c3 graph: make the ahead-behind docs clearer
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.
2013-03-22 20:27:59 +01:00
Edward Thomson
359fc2d241 update copyrights 2013-01-08 17:31:27 -06:00
Scott J. Goldman
7d26c410bf Fix a bunch of leaks, error handling cases 2012-12-09 21:55:51 -08:00
Scott J. Goldman
e51c8b99be Fix mark_parents() to account for bad luck traversals
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.
2012-12-09 21:24:47 -08:00
Scott J. Goldman
9c2a4e8c47 Morph copy of git_merge__bases_many() -> mark_parents()
Integrate mark_parents() with the ahead_behind() code.
2012-12-09 21:01:46 -08:00
Scott J. Goldman
a3a81ae542 Copy git_merge__bases_many() for new ahead-behind code
To be used as a basis for a function which marks nodes with parents
up to the merge base.
2012-12-09 20:43:26 -08:00
Carlos Martín Nieto
da82043736 graph: plug leak 2012-11-30 15:26:45 +01:00
Russell Belfer
d5e44d8498 Fix function name and add real error check
`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.
2012-11-29 17:02:27 -08:00
Scott J. Goldman
b994bfe339 graph.c: prune includes 2012-11-28 18:59:13 -08:00
Scott J. Goldman
0984c8768d Rename git_count_ahead_behind -> git_graph_ahead_behind
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 *`.
2012-11-28 18:54:57 -08:00