otac0n / WebGitNet

WebGit .NET is an ASP.NET MVC app that provides access to your git repositories over HTTP. It supports browsing in a web browser AND push / pull over Git's "Smart HTTP protocol".
zlib License
133 stars 62 forks source link

shallow clone from a WebGitNet hosted repository fails #77

Closed 101shipit closed 11 years ago

101shipit commented 11 years ago

performing a shallow clone from a WebGitNet hosted repository fails for example:

git clone --depth=1 http://myserver.mydomain/WebGitNet/git/MyRepository

Cloning into 'MyRepository'...
fatal: protocol error: bad line length character: <!DO
fatal: write error: Invalid argument

however a shallow clone from other servers/sources such as gitHub for example works as expected.

git clone --depth=1 https://github.com/otac0n/WebGitNet.git 

Cloning into 'WebGitNet'...
remote: Counting objects: 296, done.
remote: Compressing objects: 100% (259/259), done.
emote: Total 296 (delta 36), reused 248 (delta 20)
Receiving objects: 100% (296/296), 3.95 MiB | 1.34 MiB/s, done.
Resolving deltas: 100% (36/36), done.
jberezanski commented 11 years ago

The characters "<!DO" are actually the beginnning of the ASP.NET application error page. I can reproduce this issue on my setup, the error reported by the server is:

[HttpException]: Server cannot set status after HTTP headers have been sent.

   at System.Web.HttpResponse.set_StatusCode(Int32 value)
   at WebGitNet.ActionResults.GitStreamResult.ExecuteResult(ControllerContext context)
   at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17()
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
   at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
   at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
   at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
otac0n commented 11 years ago

Sorry for the long response time.

I'm looking into it.

otac0n commented 11 years ago

Shallow clone seems to work now. I'm not sure why Git was returning a non-zero exit code. However, setting the status code after streaming results was certainly a bug. Thanks for the report!

101shipit commented 11 years ago

thanks, Tested and it's working for me now.