Update build scripts to fetch new changes.

Prevent future mistakes when creating tags by always fetching the branch
head before bumping version numbers or creating tags.
Add an additional test for CakeRequest::referer().

Trying to track down the issue for #3897. This test coverage was
missing, so fix that.
Fix issue where redirectURLs were not generated correctly.

When the first path segment matches the base path an incorrect URL was
generated. Trimming slashes off makes Router normalize the URL correctly
as the leading / implies that the base is already prepended.

Fixes #3897