-
Notifications
You must be signed in to change notification settings - Fork 534
Conversation
alternatives(A)
(B) since
I'd vote for (B), but it could be done in a subsequent PR, or if required during the revision. |
Explaining recursive behaviorgiven Here is the explanation about how it works 👇 The history can potentially be walked as many times as candidates provided for In the worst scenario, the history of each candidate will be fully traversed as many times as orphan branches are included in the candidates to be analyzed. given this history:
then (assuming that topological order matches the historical order):
assuming that topological order DOES NOT match the historical order for
|
Performance
|
repo | master ancestors |
list all | list only one |
---|---|---|---|
kubernetes/kubernetes | 76018 commits | ~5s |
~0.03s |
torvalds/linux | 812644 commits | ~60s |
~5s |
git log master
tooked ~10s
over torvalds/linux
, and almost ~1s
over kubernetes/kubernetes
.
Testing real PRs from kubernetes/kubernetes
:
I tried go-git/_examples/merge_base
command over the last 245 merged PR from kubernetes/kubernetes
(there is no valid PRs in linux
repo), to calculate the merge-base
between their base
and head
:
- 140 PRs required a full traverse, taking
~5s
, - 105 PRs were analyzed almost instantaneously in
~.3s
, without a full history traverse.
Conclusions and possible improvements:
When the passed commits are Independents it is needed to fully traverse the history at least once.
There is a possible improvement to avoid it:
- Stop walking the history of the ancestors of the common ancestors already found.
If you want, it could be done in this or in a subsequent PR.
Travis is failing https://travis-ci.org/src-d/go-git/jobs/511125046#L668 because the new test cases depend on new fixtures, to be merged by src-d/go-git-fixtures#13 |
AppVeyor failed for the same reason; now that src-d/go-git-fixtures#13 was merged it should pass, but I can not restart the build. |
I have some doubts about the API, since go-git, is getting being some times is hard to find if X functionality is implemented or not. How this PR is done, the functions are spare, in a big package, some my I want to consider 2 different options:
|
I agree with your @mcuadros and both proposals would fit me, so just let me know. |
132367f
to
855acd2
Compare
|
@smola what about the other option? |
I agree with @mcuadros that |
Is this work abandoned, or likely to move forward? I'm trying to decide whether to fork and merge this, or if it's likely to end up in the upstream sometime soon. Is all that's left here to decide on where the package lines are drawn? |
Not dead on my side ;) |
Thanks for your suggestions! Done as you recommended during your code review:
Also, I refactored should I address any other issue? I should squash some commits in order to have a cleaner history, so let me know before you merge. |
Yes please clean the history |
Signed-off-by: David Pordomingo <[email protected]>
e0029d1
to
f62852b
Compare
Is there going to be a new release soon containing this merge?? (If not, there definitely should be!) |
I'll also rebase #1096 on top of current go-git, now that this has been merged. |
suggested by #1078
blocked by src-d/go-git-fixtures#13blocks src-d/lookout#530
This PR adds some features from
git merge-base
command.note:
you can see more details about this PR, alternatives and performance concerns in the comments below
Iit was implemented a new walker
filterCommitIter
(likebfsCommitIterator
one), and three functionsMergeBase
,IsAncestor
andIndependents
.plumbing/object.filterCommitIter
git.MergeBase(first, second *object.Commit) ([]*object.Commit, error)
git.IsAncestor(first, second *object.Commit) (bool, error)
git.Independents(commits []*object.Commit) ([]*object.Commit, error)