rit
Implementation of Git in Rust
Environment
- Rust 1.69.0
Note
About Git
.git
when you execute git init
Directory structure of $ git init
$ tree -L 2 .git
.git
├── HEAD
├── config
├── description
├── hooks
├── info
├── objects
│ ├── info
│ └── pack
└── refs
├── heads
└── tags
Essential files and directories of Git
Essential files and directories of Git in .git
directory are as follows:
objects
- A directory that stores all contents (text / binary files) managed by Git
HEAD
- A text file that points to the current branch. A content of
HEAD
contains file path to files inrefs
directory.
- A text file that points to the current branch. A content of
refs
- A directory that stores pointers (branch / tag) that point to commit objects in contents. A content of
refs
directory is as follows:heads
- A directory that stores pointers (branch) that point to commit objects in contents
tags
- A directory that stores pointers (tag) that point to commit objects in contents
- A directory that stores pointers (branch / tag) that point to commit objects in contents. A content of
index
- A file that stores the information of the staging area
commands of cargo
# rustc
rustc main.rs
./main
rustc main.rs -o bin/rit
./bin/rit
# cargo
cargo new [project name]
cargo init
cargo build # build for development (no optimization, fast build time, slow runtime)
cargo build --release # build for release (optimization, slow build time, fast runtime)
cargo run
cargo run --release
cargo check
cargo update
cargo test
References
- (Zenn, 2020/11) Rust でつくる Git 入門
- github.com/uzimaru0000/clumsy
- reference implementation of Git in Rust
- official documentation of Git
- (2015/09) mercari engineering - Git のつくりかた
- (Slideshare, 2015/08) Git のつくりかた YAPC::Asia 2015 @DQNEO
- (Zenn, 2021/08)Git のインデックスの中身
- github.com/git/git
- Git Source Code Mirror
- github.com/DQNEO/minigit
- Implementation of Git in C
- github.com/TaKO8Ki/gobang
- A cross-platform TUI database management tool written in Rust
- for Rust edition
- github.com/starship/starship
- The minimal, blazing-fast, and infinitely customizable prompt for any shell!