Mighty-M/git-bin — pull request #8 by hbons (2012-12-12 20:36:51+00:00)
Title: Fix exception when using an empty S3 bucket

today i took another shot at trying out git-bin. i created a fresh S3 bucket with no files in it. when doing a `git bin push` i got this exception:

```
mono --debug /Users/hbons/Projects/git-bin/git-bin/bin/Debug/git-bin.exe push

[git-bin] Uncaught exception, please report this bug! System.ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
at System.Collections.Generic.List`1[GitBin.GitBinFileInfo].get_Item (Int32 index) [0x00024] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/corlib/System.Collections.Generic/List.cs:636
at GitBin.Remotes.S3Remote.ListFiles () [0x0005e] in /Users/hbons/Projects/git-bin/git-bin/Remotes/S3Remote.cs:44
at GitBin.Commands.PushCommand.Execute () [0x00000] in /Users/hbons/Projects/git-bin/git-bin/Commands/PushCommand.cs:27
at GitBin.Program.Main (System.String[] args) [0x00022] in /Users/hbons/Projects/git-bin/git-bin/Program.cs:20
```

because of the do-while loop, git-bin tries to iterate over all the files at least once in the ListFiles() method of the S3 remote. i've changed this to a regular while-loop, which fixes the exception and makes git-bin behave normally again.