A lightweight, systems-level Version Control System written in C++17. Reconstructs Git’s object database, Merkle DAG tracking, and binary index parsing from the ground up using Object-Oriented Programming (OOP) principles.
- Cryptographic Hashing: Native SHA-1 integration and
zlibblob compression. - Binary Index Parsing: Optimized
.git/indexstaging area parser with strict Endianness (byte-order) management. - POSIX Integration: Nanosecond-precision
statusdiffing utilizing<sys/stat.h>. - Merkle DAG Generation: Recursive tree building and traversal algorithms to manage repository history.
The engine successfully mimics the following core Git sub-commands:
- Plumbing:
hash-object,cat-file,ls-tree,ls-files,check-ignore,rev-parse,show-ref - Porcelain:
init,add,rm,commit,status,log,checkout,tag
- C++17 Compatible Compiler (
clang++) zliblibrary (natively available on macOS)- macOS Native
CommonCrypto(for SHA-1)
Build the executable using the following command:
clang++ -std=c++17 main.cpp libwyag.cpp -o wyag -lzQuick Start
Bash
# Initialize a new repository
./wyag init
# Create and stage a file
echo "Hello GitCore" > readme.txt
./wyag add readme.txt
# Commit the changes
./wyag commit -m "Initial commit"
# Check the history
./wyag log HEAD
Acknowledgements This C++ adaptation was built following the excellent foundational concepts outlined in the tutorial: Write Yourself a Git by Thibault Polge. Link : https://wyag.thb.lt/#getting-started