コード例 #1
0
ファイル: T0003_Basic_Write.cs プロジェクト: mdekrey/GitSharp
        public void Write_Blob()
        {
            ObjectId id = new ObjectWriter(db).WriteBlob(new FileInfo("Resources/single_file_commit/i-am-a-file"));
            Assert.AreEqual("95ea6a6859af6791464bd8b6de76ad5a6f9fad81", id.ToString());
            Assert.AreEqual(Inspector.Inspect("Resources/single_file_commit", "95ea6a6859af6791464bd8b6de76ad5a6f9fad81"), new Inspector(db).Inspect(id));

            writeTrashFile("i-am-a-file", "and this is the data in me\r\n\r\n");
            id = new ObjectWriter(db).WriteBlob(new FileInfo(trash+"/i-am-a-file"));
            Assert.AreEqual("95ea6a6859af6791464bd8b6de76ad5a6f9fad81", id.ToString());
        }
コード例 #2
0
ファイル: T0003_Basic_Write.cs プロジェクト: mdekrey/GitSharp
 public void test024_createCommitNonAscii()
 {
     ObjectId emptyId = new ObjectWriter(db).WriteBlob(new byte[0]);
     var almostEmptyTree = new Tree(db);
     almostEmptyTree.AddEntry(new FileTreeEntry(almostEmptyTree, emptyId, "empty".getBytes(), false));
     ObjectId almostEmptyTreeId = new ObjectWriter(db).WriteTree(almostEmptyTree);
     var commit = new Commit(db)
                  	{
                  		TreeId = almostEmptyTreeId,
                  		Author = new PersonIdent("Joe H\u00e4cker", "*****@*****.**", 4294967295000L, 60),
                  		Committer = new PersonIdent("Joe Hacker", "*****@*****.**", 4294967295000L, 60),
                  		Encoding = Encoding.GetEncoding("ISO-8859-1"),
                  		Message = "\u00dcbergeeks"
                  	};
     ObjectId cid = new ObjectWriter(db).WriteCommit(commit);
     var s = new Inspector(db).Inspect(cid);
     Assert.AreEqual("2979b39d385014b33287054b87f77bcb3ecb5ebf", cid.ToString());
 }