]> source.dussan.org Git - gitea.git/commit
routers/repo/release: Use correct branch reference (#3330)
author마누엘 <nalla@hamal.uberspace.de>
Wed, 27 Jul 2016 08:57:32 +0000 (10:57 +0200)
committer无闻 <u@gogs.io>
Wed, 27 Jul 2016 08:57:32 +0000 (16:57 +0800)
commitfe60ca408b7bbec43bdba18d0eded2ed586ddfdd
tree292cd7e455c5ba9b19788e8314ba464467adb9c5
parent0402c803c6904a4040cde50a5a918d5ff57e6d25
routers/repo/release: Use correct branch reference (#3330)

When calculating the current behind commit count the calculation should
use the current release target to get the total commit count. Should the
release target not exist anymore the calculation will return zero for
the newest release on that target. Older releases on that target will then
use that calculated commit count as reference.

The only use case that is now somehow invalid is when the release target
was merged / deleted after a tag on that release target:

    master 1 - - - - - - - 6
            \             /
    branch   2 - 3 - 4 - 5

When `4` is the last tag on branch `branch` and the branch `branch` is not
yet deleted the calculated numbers would be:

    1 commits to branch since this release

Now if the branch `branch` gets deleted the calculation function will not
find the branch and use the commit count of the newest release (`4`) as
reference resulting in:

    0 commit to branch since this release

This fixes #3326
routers/repo/release.go