Return the size we'd need to write to instead of simply an
error. Split the function into two to be used later by the upstream
configuration functions.
The new tests were not taking core.filemode into account when
testing file modes after repo initialization. Fixed that and some
other Windows warnings that have crept in.