• Stars
    star
    7,202
  • Rank 5,392 (Top 0.2 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created over 6 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An idiomatic, lean, fast & safe pure Rust implementation of Git

Rust Crates.io

gitoxide is an implementation of git written in Rust for developing future-proof applications which strive for correctness and performance while providing a pleasant and unsurprising developer experience.

gitoxide provides the gix and ein binaries for use on the command-line to allow experimentation with key features like fetch and clone, and to validate the usability and control of the API offered by the gix crate.

gitoxide aspires to be a production-grade server implementation and the ein binary aspires to become the default way to interact with git repositories.

asciicast

Development Status

The command-line tools as well as the status of each crate is described in the crate status document.

For use in applications, look for the gix crate, which serves as entrypoint to the functionality provided by various lower-level plumbing crates like gix-config.

Feature Discovery

Can gix do what I need it to do?

The above can be hard to answer and this paragraph is here to help with feature discovery.

Look at crate-status.md for a rather exhaustive document that contains both implemented and planned features.

Further, the gix crate documentation with the git2 search term helps to find all currently known git2 equivalent method calls. Please note that this list is definitely not exhaustive yet, but might help if you are coming from git2.

What follows is a high-level list of features and those which are planned:

  • clone
  • fetch
  • blame
  • push
  • reset
  • status
  • blob-diff
  • merge
  • rebase
  • commit
  • worktree checkout and worktree stream
  • reading and writing of objects
  • reading and writing of refs
  • reading and writing of .git/index
  • reading and writing of git configuration
  • pathspecs
  • revspecs
  • .gitignore and .gitattributes

Crates

Follow linked crate name for detailed status. Please note that all crates follow semver as well as the stability guide.

Production Grade

Stabilization Candidates

Crates that seem feature complete and need to see some more use before they can be released as 1.0. Documentation is complete and was reviewed at least once.

Initial Development

These crates may be missing some features and thus are somewhat incomplete, but what's there is usable to some extent.

Stress Testing

  • Verify huge packs
  • Explode a pack to disk
  • Generate and verify large commit graphs
  • Generate huge pack from a lot of loose objects

Stability and MSRV

Our stability guide helps to judge how much churn can be expected when depending on crates in this workspace.

Installation

Download a Binary Release

Using cargo binstall, one is able to fetch binary releases. You can install it via cargo install cargo-binstall, assuming the rust toolchain is present.

Then install gitoxide with cargo binstall gitoxide.

See the releases section for manual installation and various alternative builds that are slimmer or smaller, depending on your needs, for Linux, MacOS and Windows.

Download from Arch-Repository

For Arch Linux you can download gitoxide from community repository:

pacman -S gitoxide

Download from Exherbo Linux Rust repository

For Exherbo Linux you can download gitoxide from the Rust repository:

cave resolve -x repository/rust
cave resolve -x gitoxide

From Source via Cargo

cargo is the Rust package manager which can easily be obtained through rustup. With it, you can build your own binary effortlessly and for your particular CPU for additional performance gains.

The minimum supported Rust version is documented in the CI configuration, the latest stable one will work as well.

There are various build configurations, all of them are documented here. The documentation should also be useful for packagers who need to tune external dependencies.

# A certain way to install `gitoxide` with just Rust and a C compiler installed.
# If there are problems with SSL certificates during clones, try to omit `--locked`.
cargo install gitoxide --locked --no-default-features --features max-pure 

# The default installation, 'max', is the fastest, but also needs some libraries available to build successfully.
# Installing these is platform-dependent and thus can't be explained here.
cargo install gitoxide

# For smaller binaries and even faster build times that are traded for a less fancy CLI implementation, use `lean`
# or `lean-termion` respectively.
cargo install gitoxide --locked --no-default-features --features lean

The following installs the latest unpublished release directly from git:

cargo install --git https://github.com/Byron/gitoxide  gitoxide

How to deal with build failures

On some platforms, installation may fail due to lack of tools required by C toolchains. This can generally be avoided by installation with cargo install gitoxide --no-default-features --features max-pure.

What follows is a list of known failures.

  • On Fedora, perl needs to be installed for OpenSSL to build properly. This can be done with the following command: dnf install perl (see this issue).

Usage

Once installed, there are two binaries:

  • ein
    • high level commands, porcelain, for every-day use, optimized for a pleasant user experience
  • gix
    • low level commands, plumbing, for use in more specialized cases and to validate newly written code in real-world scenarios

Project Goals

Project goals can change over time as we learn more, and they can be challenged.

  • a pure-rust implementation of git
    • including transport, object database, references, cli and tui
    • a simple command-line interface is provided for the most common git operations, optimized for user experience. A simple-git if you so will.
    • be the go-to implementation for anyone who wants to solve problems around git, and become the alternative to GitPython and libgit2 in the process.
    • become the foundation for a distributed alternative to GitHub, and maybe even for use within GitHub itself
  • learn from the best to write the best possible idiomatic Rust
    • libgit2 is a fantastic resource to see what abstractions work, we will use them
    • use Rust's type system to make misuse impossible
  • be the best performing implementation
    • use Rust's type system to optimize for work not done without being hard to use
    • make use of parallelism from the get go
    • sparse checkout support from day one
  • assure on-disk consistency
    • assure reads never interfere with concurrent writes
    • assure multiple concurrent writes don't cause trouble
  • take shortcuts, but not in quality
    • binaries may use anyhow::Error exhaustively, knowing these errors are solely user-facing.
    • libraries use light-weight custom errors implemented using quick-error or thiserror.
    • internationalization is nothing we are concerned with right now.
    • IO errors due to insufficient amount of open file handles don't always lead to operation failure
  • Cross platform support, including Windows
    • With the tools and experience available here there is no reason not to support Windows.
    • Windows is tested on CI and failures do prevent releases.

Non-Goals

Project non-goals can change over time as we learn more, and they can be challenged.

  • replicate git command functionality perfectly
    • git is git, and there is no reason to not use it. Our path is the one of simplicity to make getting started with git easy.
  • be incompatible to git
    • the on-disk format must remain compatible, and we will never contend with it.
  • use async IO everywhere
    • for the most part, git operations are heavily reliant on memory mapped IO as well as CPU to decompress data, which doesn't lend itself well to async IO out of the box.
    • Use blocking as well as gix-features::interrupt to bring operations into the async world and to control long running operations.
    • When connecting or streaming over TCP connections, especially when receiving on the server, async seems like a must though, but behind a feature flag.

Contributions

If what you have seen so far sparked your interest to contribute, then let us say: We are happy to have you and help you to get started.

❗️Note❗️: For cloning, gix-lfs needs to be locally installed or the checkout will fail. git lfs install must have been called once, followed by git lfs pull to replace the lfs-pointer files.

We recommend running just test check-size during the development process to assure CI is green before pushing.

A backlog for work ready to be picked up is available in the Project's Kanban board, which contains instructions on how to pick a task. If it's empty or you have other questions, feel free to start a discussion or reach out to @Byron privately.

For additional details, also take a look at the collaboration guide.

Getting started with Video Tutorials

  • Learning Rust with Gitoxide
    • In 17 episodes you can learn all you need to meaningfully contribute to gitoxide.
  • Getting into Gitoxide
    • Get an introduction to gitoxide itself which should be a good foundation for any contribution, but isn't a requirement for contributions either.
  • Gifting Gitoxide
    • See how PRs are reviewed along with a lot of inner monologue.

Other Media

Roadmap

Features for 1.0

Provide a CLI to for the most basic user journey:

  • initialize a repository
  • fetch
    • and update worktree
  • clone a repository
    • bare
    • with working tree
  • create a commit after adding worktree files
  • add a remote
  • push
    • create (thin) pack

Ideas for Examples

  • gix tool open-remote open the URL of the remote, possibly after applying known transformations to go from ssh to https.
  • tix as example implementation of tig, displaying a version of the commit graph, useful for practicing how highly responsive GUIs can be made.
  • Something like git-sizer, but leveraging extreme decompression speeds of indexed packs.
  • Open up SQL for git using sqlite virtual tables. Check out gitqlite as well. What would an MVP look like? Maybe even something that could ship with gitoxide. See this go implementation as example.
  • A truly awesome history rewriter which makes it easy to understand what happened while avoiding all pitfalls. Think BFG, but more awesome, if that's possible.
  • gix-tui should learn a lot from fossil-scm regarding the presentation of data. Maybe this can be used for prompts. Probably magit has a lot to offer, too.

Ideas for Spin-Offs

  • A system to integrate tightly with gix-lfs to allow a multi-tier architecture so that assets can be stored in git and are accessible quickly from an intranet location (for example by accessing the storage read-only over the network) while changes are pushed immediately by the server to other edge locations, like the cloud or backups. Sparse checkouts along with explorer/finder integrations make it convenient to only work on a small subset of files locally. Clones can contain all configuration somebody would need to work efficiently from their location, and authentication for the git history as well as LFS resources make the system secure. One could imagine encryption support for untrusted locations in the cloud even though more research would have to be done to make it truly secure.
  • A syncthing like client/server application. This is to demonstrate how lower-level crates can be combined into custom applications that use only part of git's technology to achieve their very own thing. Watch out for big file support, multi-device cross-syncing, the possibility for untrusted destinations using full-encryption, case-insensitive and sensitive filesystems, and extended file attributes as well as ignore files.
  • An event-based database that uses commit messages to store deltas, while occasionally aggregating the actual state in a tree. Of course it's distributed by nature, allowing people to work offline.
    • It's abstracted to completely hide the actual data model behind it, allowing for all kinds of things to be implemented on top.
    • Commits probably need a nanosecond component for the timestamp, which can be added via custom header field.
    • having recording all changes allows for perfect merging, both on the client or on the server, while keeping a natural audit log which makes it useful for mission critical databases in business.
    • Applications
      • Can markdown be used as database so issue-trackers along with meta-data could just be markdown files which are mostly human-editable? Could user interfaces be meta-data aware and just hide the meta-data chunks which are now editable in the GUI itself? Doing this would make conflicts easier to resolve than an sqlite database.
      • A time tracker - simple data, very likely naturally conflict free, and interesting to see it in terms of teams or companies using it with maybe GitHub as Backing for authentication.
        • How about supporting multiple different trackers, as in different remotes?

Shortcomings & Limitations

Please take a look at the SHORTCOMINGS.md file for details.

Credits

  • itertools (MIT Licensed)
    • We use the izip! macro in code
  • deflate2 (MIT Licensed)
    • We use various abstractions to implement decompression and compression directly on top of the rather low-level miniz_oxide crate

πŸ™ Special Thanks πŸ™

At least for now this section is exclusive to highlight the incredible support that Josh Triplett has provided to me in the form of advice, sponsorship and countless other benefits that were incredibly meaningful. Going full time with gitoxide would hardly have been feasible without his involvement, and I couldn't be more grateful 😌.

License

This project is licensed under either of

at your option.

Fun facts

  • Originally @Byron was really fascinated by this problem and believes that with gitoxide it will be possible to provide the fastest solution for it.
  • @Byron has been absolutely blown away by git from the first time he experienced git more than 13 years ago, and tried to implement it in various shapes and forms multiple times. Now with Rust @Byron finally feels to have found the right tool for the job!

More Repositories

1

dua-cli

View disk space usage and delete unwanted data, fast.
Rust
2,803
star
2

google-apis-rs

A binding and CLI generator for all Google APIs
Rust
1,011
star
3

prodash

report progress of concurrent applications and display it in various ways
Rust
255
star
4

open-rs

Open a path or URL with the system-defined program
Rust
234
star
5

jwalk

Filesystem walk performed in parallel with streamed and sorted results
Rust
209
star
6

trash-rs

A Rust library for moving files to the Recycle Bin
Rust
168
star
7

crates-io-cli

Interact with crates.io from the command-line
Rust
93
star
8

treediff-rs

Extract differences between arbitrary datastructures
Rust
69
star
9

github-star-counter

A tool to query direct (and indirect) stars of a GitHub user or organization
Rust
59
star
10

termbook

A runner for `mdbooks` to keep your documentation tested.
Rust
46
star
11

pulldown-cmark-to-cmark

Convert pulldown-cmark Events back to the string they were parsed from
Rust
38
star
12

cargo-smart-release

Release complex cargo-workspaces automatically with changelog generation, used by `gitoxide`
Rust
37
star
13

learning-rust-with-gitoxide

Our sessions when learning Rust with gitoxide
Rust
36
star
14

yup-hyper-mock

`hyper-mock` is a utility library to help hyper clients with their testing
Rust
29
star
15

benchmarksgame-cvs-mirror

A git mirror of the benchmarksgame cvs repository
Java
17
star
16

bsuite

Provide a plugin with tools to handle ptex files
C++
16
star
17

json-tools

A zero-copy json-lexer, filters and serializer.
Rust
15
star
18

rust-tracer

A pet raytracer to see how fast rust can go
Rust
15
star
19

crates-index-diff-rs

Learn what's changed on crates.io
Rust
14
star
20

fs-utils-rs

Utilities to help working with the filesytem
Rust
12
star
21

godi

Tool to verify data integrity with maximised performance
Go
9
star
22

bcore

powerful application framework built to integrate, not separate
Python
8
star
23

tui-crates

Various crates related to handling terminal user interfaces
Rust
7
star
24

catchit-rs

A simple and fun game made with Piston and Rust
Rust
7
star
25

anon-csv-cli

A command-line utility for anonymising CSV files
Rust
6
star
26

therror

`thiserror` + killer-feature
Rust
6
star
27

cli-template-rs

A template for command-line applications in Rust - just clone to get started
Shell
5
star
28

dotfiles

My configuration files, with auto-setup for quick account initialization
Shell
4
star
29

git-count

A simple program to count objects in git repositories - for trying the `git2` library
Rust
4
star
30

BPT

*unmaintained repository * - see BSuite
C++
3
star
31

pgit

Git Command-Line Tools in Python
Python
3
star
32

git-reconstruct

A Rust tool to reconstruct git history from tarball dumps. This is especially useful when a device vendor bases its code on an unknown commit of the git of a system on a chip vendor.
Rust
3
star
33

merchants-guide

An implementation of the merchants guide coding challenge in Rust the way I would love to see it
Rust
2
star
34

rust-hack-and-learn

A web-app for managing Katas for Rust
JavaScript
2
star
35

gitplusplus

Rewrite git using c++11 facilities
C++
2
star
36

bit

A collection of frameworks most useful to running IT infrastructure
Python
2
star
37

shallow-source

for observing shallow protocol interactions with a remote
2
star
38

kattis-autori

https://open.kattis.com/problems/autori
Shell
1
star
39

kattis-sibice

https://open.kattis.com/problems/sibice
Shell
1
star
40

javascript_the-good-parts

Repository with the book's examples, in comparison with Rust
JavaScript
1
star
41

bshotgun

Write better shotgun tools, faster
Python
1
star
42

kattis-aaah

Shell
1
star
43

reproduce-rayon-hang

minimal sample to reproduce a hang caused by jwalk running within par_iter()
Rust
1
star
44

npm-tools-rs

A Rust library to help dealing with NPM modules
Rust
1
star
45

kattis-scaling-recipes

https://open.kattis.com/problems/recipes
Rust
1
star
46

kattis-aliencodebreaker

https://open.kattis.com/problems/aliencodebreaking
Rust
1
star
47

kattis-tarifa

https://open.kattis.com/problems/tarifa
Shell
1
star
48

failure-tools

Various tools to be used in conjunction with the 'failure' crate.
Rust
1
star
49

and-rs

Porcelain for your Android-SDK tool suite
Rust
1
star
50

bbuild

A cmake based multi-platform build system with bcore integration
Python
1
star
51

kattis-pig-latin

https://open.kattis.com/problems/piglatin
Shell
1
star
52

kattis-filip

https://open.kattis.com/problems/filip
Shell
1
star
53

kattis-cli-template-rs

A template for quickly getting started on kattis samples
Shell
1
star
54

gogit

If I ever wanted to learn go programming, I would implement the git-core. Probably this is never going to happen.
Go
1
star
55

hotel-reservations

An implementation of the hotel reservations coding challenge in Rust the way I would love to see it
Rust
1
star
56

kattis-recount

https://open.kattis.com/problems/recount
Shell
1
star
57

git-commits-by-blob

An alternative backend for https://github.com/ali1234/gitxref
Rust
1
star
58

byron

1
star
59

atom-byrons-edittools

Comforts you with smart tools aiding your editing workflow in Atom
CoffeeScript
1
star
60

kattis-shattered-cake

https://open.kattis.com/problems/shatteredcake
Shell
1
star
61

mars-rover

An implementation of the mars rover coding challenge in Rust the way I would love to see it
Rust
1
star
62

kattis-quadrant

https://open.kattis.com/problems/quadrant
Shell
1
star