使用自定义传输进行抓取/克隆/拉取时发生异常

时间:2018-07-11 13:39:22

标签: libgit2sharp

我写了一个自定义的smarttransport。提取,提取或克隆后,我得到有效数据,但是该方法引发LibGit2Sharp异常,并显示“从zlib流读取错误”。

使用上传包读取->写入->读取->写入进行传输。

阅读:

  

00fc5daa747d4ca7905ff8996f770ef74d1b894be3d2 HEAD multi_ack薄包装   边带边带64k ofs-delta浅加深,因为不加深   加深相对于无进展的包含标记multi_ack_detailed   symref = HEAD:refs / heads /主代理= git / 2.18.0.windows.1   003f5daa747d4ca7905ff8996f770ef74d1b894be3d2 Refs / Heads / Master   003e5daa747d4ca7905ff8996f770ef74d1b894be3d2 refs / heads / test2 0000

写:

  

0074want 5daa747d4ca7905ff8996f770ef74d1b894be3d2   multi_ack_detailed边带64k包含标签的瘦包ofs-delta   0032想要5daa747d4ca7905ff8996f770ef74d1b894be3d2 00000009done

阅读:

  

0008NAK 0023枚举对象:9个,完成。计数对象:100%   (9/9),完成。压缩对象:100%(6/6),已完成。 002b总计9   (delta 0),重用0(delta 0)02e7PACKòx£ì-1-0   + =»+ÄälºNc!6Ìß$NAé+ x-m763 [AÁ+sª$ C +!7eì[å$ í¦Àn÷^ A&ã:Cÿ+ -T#&Ö+BfàªäëKê+Úg_·µ»} +²i¨yi· ¦Ò +ï«gÅÉä+Ç   \Ú¤þ}¹©]ks_.k8¬òx£ì-=-0 @ß=º+ÄäþºÄäþpº   ZéZszûÀ} z¦ëÏ \KpêÈUqòÉk+ =-ÇU8O   àú­&oÁëÿ=óª=d+AÊ4qóÏÇ:+ã-áß»>ãf´cÌÝe>zٳƾ2*/WÙó?«ô-hOÇ ªÄu}¬- -¿ýj~Ç@9[ÿ
x£ì-1-0@Ð=º­ÄäLLöTBê¡þpmÀDñDj-²¦#¦³7}¯¦@°nël8eÔR-ª¿ëSûY'UM%IÓƒ+¹c_vx,g_3ý+¦p{--ûé4d©
DÊαα¦G¿   343-x£343   ¢Éd¸¦åîUFzÜ--£+²Ê½2.Þr³ê]ÙdhfbóPöÜÿÆø¬WRQ-ã»Ã¤J¦_Ðß¾ØKMº¥à 3Sã¦x£-¦-,+L¦QH+¤--,I,NIa.-à-3©îí+ §Ó-¿x£343 ¢Éd¸¦åîUFzÜ--£+²Ê½2.Þr³ê]ÙdhfbóPöÜÿÆø¬WRQ-=“Bnï§+ =ƒº= ¦ | [c   N +ôx£---,+ L¦QH +¤-,I,NIa.-ò   +®*ªx£340031Q(JML + Mi +®(a + §u¦sQ?-§î¦O´¢¹¦,²Û+。H> x£-¦-,+ L¦QH +¤--,)-öP yãyô

写:

  

0000

例外:

  

类型为'LibGit2Sharp.LibGit2SharpException'的未处理异常   发生在LibGit2Sharp.dll

     

其他信息:从zlib流中读取错误

Callstack:

  

bei LibGit2Sharp.Core.Ensure.HandleError(Int32 result)在   C:\ projects \ libgit2sharp \ LibGit2Sharp \ Core \ Ensure.cs:Zeile136。bei   LibGit2Sharp.Core.Proxy.git_remote_fetch(RemoteHandle远程,   IEnumerable 1 refSpecs, GitFetchOptions fetchOptions, String logMessage) in C:\projects\libgit2sharp\LibGit2Sharp\Core\Proxy.cs:Zeile 2268. bei LibGit2Sharp.Commands.Fetch(Repository repository, String remote, IEnumerable 1 refspecs,FetchOptions选项,String logMessage)   C:\ projects \ libgit2sharp \ LibGit2Sharp \ Commands \ Fetch.cs:Zeile 76.
  bei GitFunction.Test.Beta2.button1_Click(Object sender,EventArgs e)   在   C:\ TFS \ DS \ ThomasZ \ BeckhoffGitAdsService \ GitAdsServicePackage \ GitFunction.Test \ Beta2.cs:Zeile   62. bei System.Windows.Forms.Control.OnClick(EventArgs e)bei System.Windows.Forms.Button.OnClick(EventArgs e)bei   System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)北   System.Windows.Forms.Control.WmMouseUp(Message&m,MouseButtons   按钮,则Int32点击)   System.Windows.Forms.Control.WndProc(Message&m)北   System.Windows.Forms.ButtonBase.WndProc(Message&m)北   System.Windows.Forms.Button.WndProc(Message&m)北   System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&m)   bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&   m)System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr)   hWnd,Int32 msg,IntPtr wparam,IntPtr lparam)bei   System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&msg)
  i   System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr   dwComponentID,Int32原因,Int32 pvLoopData)bei   System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32   原因,ApplicationContext上下文)bei   System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32   原因,ApplicationContext上下文)bei   System.Windows.Forms.Application.Run(Form mainForm)bei   GitFunction.Test.Program.Main()在   C:\ TFS \ DS \ ThomasZ \ BeckhoffGitAdsService \ GitAdsServicePackage \ GitFunction.Test \ Program.cs:Zeile   19. bei System.AppDomain._nExecuteAssembly(RuntimeAssembly程序集,String [] args)bei   System.AppDomain.ExecuteAssembly(字符串assemblyFile,证据   assemblySecurity,String [] args)bei   Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
  bei System.Threading.ThreadHelper.ThreadStart_Context(对象状态)
  bei System.Threading.ExecutionContext.RunInternal(ExecutionContext   executionContext,ContextCallback回调,对象状态,布尔值   reserveSyncCtx)bei   System.Threading.ExecutionContext.Run(ExecutionContext   executionContext,ContextCallback回调,对象状态,布尔值   reserveSyncCtx)bei   System.Threading.ExecutionContext.Run(ExecutionContext   executionContext,ContextCallback回调,对象状态)bei   System.Threading.ThreadHelper.ThreadStart()

版本:

  • git版本2.18.0.windows.1
  • 赢得10 x64
  • LibGit2Sharp 0.24.0.0
  • LibGit2Sharp 0.25.0.0

1 个答案:

答案 0 :(得分:0)

仅供参考: UTF8Encoding和Encoding.Utf8不相等。 Encoding.Utf8添加了UTF8 BOM(字节顺序标记)。这导致此错误。在我的代码中将所有编码都设置为UTF8Encoding解决了我的问题。