Skip to content

Improve the latest modifier detection in UpstreamMerge

The change actually takes place in RemoteRepository#log since the --topo-order git-log option makes more sense to use by default.

We now use the --topo-order git-log option instead of --author-date-order since it keeps commits that are coming from a merged branch grouped after their related merge commit.

For instance, with the --author-date-order we would have:

$ git log --author-date-order --date=short --format="%aN - %ad - %s" -- Gemfile.lock

474b502afe2 - Rémy Coutable - 2018-11-13 - Merge branch '53289-update-haml_lint-to-0-28-0' into 'master'
1818570c17c - Rémy Coutable - 2018-11-13 - Merge branch '53291-update-ffaker-to-2-10-0' into 'master'
fb8946406b2 - GitLab Bot - 2018-11-12 - Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-11-12
a407bba81a3 - Rémy Coutable - 2018-11-12 - Merge branch 'sh-bump-redis-store' into 'master'
1116de5eeb2 - Rémy Coutable - 2018-11-12 - Merge branch 'sh-bump-mime-types' into 'master'
db51ffbfaa6 - Sean McGivern - 2018-11-12 - Resolve the remaining lockfile conflicts
5b25240c283 - Sean McGivern - 2018-11-12 - Resolve bundler lockfiles
76235ee0655 - Sean McGivern - 2018-11-12 - Merge branch 'sh-bump-sidekiq' into 'master'
ce122cb5c0f - GitLab Bot - 2018-11-12 - Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-11-12
ca3e9b97592 - Sean McGivern - 2018-11-12 - Merge branch 'blackst0ne-add-discord-service' into 'master'
e01b1907bb7 - Stan Hu - 2018-11-10 - Bump redis-store to 1.6.0
1e1f99f2b1b - Alejandro Rodríguez - 2018-11-10 - Update gitlab-markup gem to avoid binary name collision
acc1cc068e5 - Alejandro Rodríguez - 2018-11-10 - Update gitlab-markup gem to avoid binary name collision
9fa3086d09e - Stan Hu - 2018-11-09 - Bump mime-types to 3.2.2

but with the --topo-order we have a more useful ordering:

$ git log --topo-order --date=short --format="%aN - %ad - %s" -- Gemfile.lock

474b502afe2 - Rémy Coutable - 2018-11-13 - Merge branch '53289-update-haml_lint-to-0-28-0' into 'master'
c94efdaccf8 - Takuya Noguchi - 2018-10-29 - Update haml_lint to 0.28.0
1818570c17c - Rémy Coutable - 2018-11-13 - Merge branch '53291-update-ffaker-to-2-10-0' into 'master'
18db027d4b3 - Takuya Noguchi - 2018-10-29 - Update ffaker to 2.10.0
fb8946406b2 - GitLab Bot - 2018-11-12 - Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-11-12
a407bba81a3 - Rémy Coutable - 2018-11-12 - Merge branch 'sh-bump-redis-store' into 'master'
e01b1907bb7 - Stan Hu - 2018-11-10 - Bump redis-store to 1.6.0
1116de5eeb2 - Rémy Coutable - 2018-11-12 - Merge branch 'sh-bump-mime-types' into 'master'
9fa3086d09e - Stan Hu - 2018-11-09 - Bump mime-types to 3.2.2

Now, since we look at the non-merges commits only in UpstreamMerge#latest_modifier, the actual last commit that was merged wasn't the one with the most recent date (db51ffbfaa6), but the one for which the merge commit was the most recent (c94efdaccf8).

We can see that if we add the --no-merges option:

$ git log --author-date-order --date=short --format="%h - %aN - %ad - %s" --no-merges -- Gemfile.lock

db51ffbfaa6 - Sean McGivern - 2018-11-12 - Resolve the remaining lockfile conflicts
5b25240c283 - Sean McGivern - 2018-11-12 - Resolve bundler lockfiles
e01b1907bb7 - Stan Hu - 2018-11-10 - Bump redis-store to 1.6.0
1e1f99f2b1b - Alejandro Rodríguez - 2018-11-10 - Update gitlab-markup gem to avoid binary name collision
acc1cc068e5 - Alejandro Rodríguez - 2018-11-10 - Update gitlab-markup gem to avoid binary name collision
9fa3086d09e - Stan Hu - 2018-11-09 - Bump mime-types to 3.2.2

gives the wrong latest modifier, while the following gives a more accurate result:

$ git log --topo-order --date=short --format="%h - %aN - %ad - %s" --no-merges -- Gemfile.lock

c94efdaccf8 - Takuya Noguchi - 2018-10-29 - Update haml_lint to 0.28.0
18db027d4b3 - Takuya Noguchi - 2018-10-29 - Update ffaker to 2.10.0
e01b1907bb7 - Stan Hu - 2018-11-10 - Bump redis-store to 1.6.0
9fa3086d09e - Stan Hu - 2018-11-09 - Bump mime-types to 3.2.2

/cc @smcgivern @rspeicher

Merge request reports

Loading