public static LsTreeEntry ParseFromLsTreeLine(string line)
            {
                if (DiffTreeResult.IsLsTreeLineOfType(line, DiffTreeResult.BlobMarker))
                {
                    LsTreeEntry blobEntry = new LsTreeEntry();
                    blobEntry.Sha      = line.Substring(DiffTreeResult.TypeMarkerStartIndex + DiffTreeResult.BlobMarker.Length, GVFSConstants.ShaStringLength);
                    blobEntry.Filename = GitPathConverter.ConvertPathOctetsToUtf8(line.Substring(line.LastIndexOf("\t") + 1).Trim('"'));

                    return(blobEntry);
                }

                return(null);
            }
Exemple #2
0
            public static LsTreeEntry ParseFromLsTreeLine(string line)
            {
                int blobIndex = line.IndexOf(GitCatFileProcess.BlobMarker);

                if (blobIndex >= 0)
                {
                    LsTreeEntry blobEntry = new LsTreeEntry();
                    blobEntry.Sha      = line.Substring(blobIndex + GitCatFileProcess.BlobMarker.Length, GVFSConstants.ShaStringLength);
                    blobEntry.Filename = GitPathConverter.ConvertPathOctetsToUtf8(line.Substring(line.LastIndexOf("\t") + 1).Trim('"'));

                    return(blobEntry);
                }

                return(null);
            }
Exemple #3
0
 public void FilepathWithoutOctetsAsFileAndFolder()
 {
     GitPathConverter.ConvertPathOctetsToUtf8(TestPath + OctetEncoded + TestPath + OctetEncoded + ".txt").ShouldEqual(TestPath + Utf8Encoded + TestPath + Utf8Encoded + ".txt");
 }
Exemple #4
0
 public void FilepathWithoutOctetsAsFilenameNoExtension()
 {
     GitPathConverter.ConvertPathOctetsToUtf8(TestPath + OctetEncoded + ".txt").ShouldEqual(TestPath + Utf8Encoded + ".txt");
 }
Exemple #5
0
 public void FilepathWithoutOctetsAsFilename()
 {
     GitPathConverter.ConvertPathOctetsToUtf8(TestPath + OctetEncoded).ShouldEqual(TestPath + Utf8Encoded);
 }
Exemple #6
0
 public void FilepathWithoutOctets()
 {
     GitPathConverter.ConvertPathOctetsToUtf8(TestPath + "test.cs").ShouldEqual(TestPath + "test.cs");
 }
Exemple #7
0
 public void EmptyFilepathTest()
 {
     GitPathConverter.ConvertPathOctetsToUtf8(string.Empty).ShouldEqual(string.Empty);
 }
Exemple #8
0
 public void NullFilepathTest()
 {
     GitPathConverter.ConvertPathOctetsToUtf8(null).ShouldEqual(null);
 }