Fix .gitmodules parsing

Handle whitespace variations in the .gitmodules file when parsing it to
get submodule information.
Merge branch 'fix-submodule-parsing' into 'master'

Fix submodule parsing (again)

Fixes gitlab-org/gitlab-ce#714.  This addresses another bug in the `Repository#submodules` method, where the `.gitmodules` file is not parsed correctly if it contains unusual whitespace formatting.  I did not add any new tests for this change, but I did submit a merge request to the test repo at gitlab-org/gitlab-git-test!2 to introduce unusual whitespace in the test repo's `.gitmodules` file.  I have updated tests ready to go to handle the breakage inherent with a new commit in the test repo, I just need to plug in the SHAs of the merge commit and the new tag (if you create one).  When the test repo changes are merged, I'll open a new MR to update gitlab_git's tests.

/cc @jacobvosmaer @dzaporozhets

See merge request !11
Reduce memory use of Diff#strip_diff_headers

In a small test, this reduced the memory needed to load a large diff from
~1300MB to ~1000MB.
Guard against nil from sub! or chomp!
Merge branch 'avoid_string_copy' into 'master'

Reduce memory use of Diff#strip_diff_headers

In a small test, this reduced the memory needed to load a large diff from
~1300MB to ~1000MB.

See merge request !12
Do not hang on to Rugged::Patches inside Diff's

From what I can tell, we do not need the 'raw_diff' anymore after
initalizing the Gitlab::Git::Diff instance. By not sticking the
'raw_diff' in an instance variable we release it for garbage collection.
Use more Rugged enumerators

When you call Rugged::Diff#patches, you ask Rugged to instantiate all
patches in the diff and hand them to you in an array. This prevents
patches we no longer need from being garbage collected. By using
Rugged::Diff#each_patch we avoid creating an intermediate array.

The same applies to Rugged::Diff#deltas.
Merge branch 'release_rugged_patch_objects' into 'master'

Release Rugged::Patch instances

This change decreases memory use for Gitlab::Git diffs by discarding the
underlying Rugged::Patch instances. In a test where we instantiate a diff with
two large (280MB) patches 10 times in a row, this gives the following before
and after. The numbers are RSS in kB in between diff instantiations.

```
$ bundle exec ruby load-large-diff.rb
 64248
1653004
2875328
2907044
2870292
2866176
2930276
2902928
2866676
2903328
2904056
```

Note how the RSS went up to 2.8GB. After this change:

```
$ bundle exec ruby load-large-diff.rb
 64896
1370196
1942892
1924828
1934300
1932872
1933548
1933552
1933552
1933552
1933552
```

1.9GB is still a lot but this looks better.

See merge request !13
Merge branch 'master' of gitlab.com:gitlab-org/gitlab_git