private LooseBlobState GetLooseBlobState(string blobSha, Action <Stream, long> writeAction, out long size) { // Ensure SHA path is lowercase for case-sensitive filesystems if (GVFSPlatform.Instance.Constants.CaseSensitiveFileSystem) { blobSha = blobSha.ToLower(); } string blobPath = Path.Combine( this.enlistment.GitObjectsRoot, blobSha.Substring(0, 2), blobSha.Substring(2)); LooseBlobState state = this.GetLooseBlobStateAtPath(blobPath, writeAction, out size); if (state == LooseBlobState.Missing) { blobPath = Path.Combine( this.enlistment.LocalObjectsRoot, blobSha.Substring(0, 2), blobSha.Substring(2)); state = this.GetLooseBlobStateAtPath(blobPath, writeAction, out size); } return(state); }
public virtual bool TryCopyBlobContentStream(string blobSha, Action <Stream, long> writeAction) { LooseBlobState state = this.GetLooseBlobState(blobSha, writeAction, out long size); if (state == LooseBlobState.Exists) { return(true); } else if (state != LooseBlobState.Missing) { return(false); } if (!this.libgit2RepoInvoker.TryInvoke(repo => repo.TryCopyBlob(blobSha, writeAction), out bool copyBlobResult)) { return(false); } return(copyBlobResult); }
private LooseBlobState GetLooseBlobState(string blobSha, Action <Stream, long> writeAction, out long size) { string blobPath = Path.Combine( this.enlistment.GitObjectsRoot, blobSha.Substring(0, 2), blobSha.Substring(2)); LooseBlobState state = this.GetLooseBlobStateAtPath(blobPath, writeAction, out size); if (state == LooseBlobState.Missing) { blobPath = Path.Combine( this.enlistment.LocalObjectsRoot, blobSha.Substring(0, 2), blobSha.Substring(2)); state = this.GetLooseBlobStateAtPath(blobPath, writeAction, out size); } return(state); }