Provides a few helper functions to easily work with directories and files.
Provides git-related functions, like initializing the repository (void initializeRepo()), generating a file's hash code (String SHA1(String filePath)), and some helper functions (String byteArrayToHex(byte[] byteArray)). The SHA1() function works by utilizing java.security.MessageDigest to generate a SHA-1 code in the form of a byte array, then converting that array into its hexadecimal representation in string form.
File compression can be enabled/disabled with setCompressData. When set to true, calls to createBLOB will compress file data using zip compression before writing to the BLOB.
void stageFile(String filePath) will add a file name and its hash to the git index file for staging.
This is a tester for repository initialization functionality. Run the main function in this file to run the tester. It repeatedly creates and deletes the git repository to ensure that the initialization function works properly. Finally, it attempts to initialize the repository twice in a row to ensure that it properly detects that the repository already exists.
A small file to ensure that our SHA-1 hashing function works properly.
This file creates a BLOB for README.md, checks its contents against the original README.md, then deletes the BLOB to test our BLOB generation functions.
First, the main function in this file runs void resetRepository(), which deletes all BLOB and test .txt files and clears the index file. Then it creates a few test .txt files, stages them, generates their blobs, then checks the index file and ensures the index file points to the correct BLOBs and original files. It compares the contents of the BLOBs and the original .txt files to ensure they are the same.