-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGitTester.java
More file actions
45 lines (38 loc) · 1.8 KB
/
GitTester.java
File metadata and controls
45 lines (38 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class GitTester
{
public static void main(String [] args) throws IOException
{
Git banana = new Git();
banana.checkAndDeleteRepo();
banana.initRepo();
File test = new File("testFile.txt"); //these two chunks of code are only used if you want to create new files or reset old ones
if(test.exists())
test.delete(); //RESETS it if needed
FileWriter fileWritter = new FileWriter(test,true);
BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
bufferWritter.write("this is a test", 0, 14);
bufferWritter.close();
// File test2 = new File("testFile2.txt");
// if(test2.exists())
// test2.delete(); //RESETS it if needed
// FileWriter fileWritter2 = new FileWriter(test2,true);
// BufferedWriter bufferWritter2 = new BufferedWriter(fileWritter2);
// bufferWritter2.write("this is a second test for secret reasons", 0, 40);
// bufferWritter2.close();
Blob bouba = new Blob("testFile.txt", Git.COMPRESS); // testing the compression features
String compressedHashName1 = bouba.toSHA1(bouba.compress("this is a test").getBytes());
String compressedHashName2 = bouba.getHashName();
if(compressedHashName1.equals(compressedHashName2))
{
System.out.println("Compression seems to work as intended.");
}
Blob bouba2 = new Blob("testFile2.txt", Git.COMPRESS);
Blob jacobISpentTwoHoursDebuggingThisCode = new Blob("test", Git.COMPRESS);
// deleteRepo deletes EVERYTHING in git directory, including the directory itself
// so only do it when you want to reset it all
}
}