From f6f5daea07099bd10c53ad71cc85389f9abeabf9 Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Fri, 9 Aug 2019 06:07:29 -0400 Subject: [PATCH] LibGit2: Remove TryCopyBlob All callers were deleted in #33. Signed-off-by: Derrick Stolee --- GVFS/GVFS.Common/Git/LibGit2Repo.cs | 40 ------------------- .../Mock/Git/MockLibGit2Repo.cs | 5 --- 2 files changed, 45 deletions(-) diff --git a/GVFS/GVFS.Common/Git/LibGit2Repo.cs b/GVFS/GVFS.Common/Git/LibGit2Repo.cs index f8c978bbb3..402bd5dd04 100644 --- a/GVFS/GVFS.Common/Git/LibGit2Repo.cs +++ b/GVFS/GVFS.Common/Git/LibGit2Repo.cs @@ -114,46 +114,6 @@ public virtual bool ObjectExists(string sha) return true; } - public virtual bool TryCopyBlob(string sha, Action writeAction) - { - IntPtr objHandle; - if (Native.RevParseSingle(out objHandle, this.RepoHandle, sha) != Native.SuccessCode) - { - return false; - } - - try - { - unsafe - { - switch (Native.Object.GetType(objHandle)) - { - case Native.ObjectTypes.Blob: - byte* originalData = Native.Blob.GetRawContent(objHandle); - long originalSize = Native.Blob.GetRawSize(objHandle); - - // TODO: This will fail in the non-virtualized world, as - // we actually need to write the data to disk instead of - // going through a filter driver! - using (Stream mem = new UnmanagedMemoryStream(originalData, originalSize)) - { - writeAction(mem, originalSize); - } - - break; - default: - throw new NotSupportedException("Copying object types other than blobs is not supported."); - } - } - } - finally - { - Native.Object.Free(objHandle); - } - - return true; - } - public void Dispose() { this.Dispose(true); diff --git a/GVFS/GVFS.UnitTests/Mock/Git/MockLibGit2Repo.cs b/GVFS/GVFS.UnitTests/Mock/Git/MockLibGit2Repo.cs index c2494ba3f9..f52f464e28 100644 --- a/GVFS/GVFS.UnitTests/Mock/Git/MockLibGit2Repo.cs +++ b/GVFS/GVFS.UnitTests/Mock/Git/MockLibGit2Repo.cs @@ -21,10 +21,5 @@ public override bool ObjectExists(string sha) { return false; } - - public override bool TryCopyBlob(string sha, Action writeAction) - { - throw new NotSupportedException(); - } } }