gitindex: correctly skip UTF-8 BOM (#230)
Previously we called buf.ReadRune to detect if we had a BOM. However,
buf.ReadRune on the BOM just consumes the first byte and returns
"\uFFFD". So this code accidently worked. In the case of the BOM the
UnreadRune call actually returned an error which we didn't check.
This updates the code to correctly detect a BOM. Additionally it doesn't
have to rely on reading then unreading. Instead we can peak at what is
remaining since this is a bytes.Buffer.
There is a risk that there are submodule files that don't have the exact
BOM we are detecting and somehow we are skipping over and working on
them due to the code before. So when this code rolls out we should
monitor production.