On 1.7.x-r1646797 branch: merge r1646785, 1646786, 1646797, resolve
conflict and adapt regression test to 1.7.x.


git-svn-id: https://svn.apache.org/repos/asf/subversion/branches/1.7.x-r1646797@1646808 13f79535-47bb-0310-9956-ffa450edef68