#2194 Fix generating the diff of two branches
Merged by pingou. Opened by pingou.
fix_diff  into  master

Download 2194.patch

Until now the algorithm was looking at the main branch and the feature
branch and for each step in both branches checking if there was a shared
commit.
Otherwise it would keep the list of the commits seen.
The first time it finds a shared commit, it stops.

Then we clear from the list of diff commits all the ones found in master.
Except that we may end up in a situation where we have in the diff list
a number of commits that are already in master but after the first one
shared.
Say:

a - b - c - d - e - f - g
      \ h

The diff list would be [h, b, a ...] since it will take some iteration
to reach the b commit on both branches.

With this commit, instead of removing all the commits that are in master
it iterates through the list of diff commits and only keep the commit
that are present before the first shared commit.

It might be a good idea to add a test case for this?

Yes, I would like that, though I am not sure how to do them

1 new commit added

  • Add unit-test checking the behavior of the diff algorithm

+1 from me.
Note that from now on, I will probably no longer believe you when you say "I am not sure how to do X" :P

Thanks for the review :)

You will note that I didn't say, it cannot be done, just that I wasn't sure how to do it :)
Turned out, I found a way :-p

Pull-Request has been merged by pingou

Metadata