Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitoxide in cargo #106

Open
32 of 47 tasks
Tracked by #449
Byron opened this issue Jun 18, 2021 · 0 comments
Open
32 of 47 tasks
Tracked by #449

gitoxide in cargo #106

Byron opened this issue Jun 18, 2021 · 0 comments
Labels
C-integrate-gitoxide "Oxidize" crates even more by replacing git2 with gitoxide

Comments

@Byron
Copy link
Member

Byron commented Jun 18, 2021

This is a fun research project to potentially drive feature development one day to allow replacing git2 with gitoxide.
In order to migrate, not all features would have to be present at first at the cost of compiling both gitoxide and git2 (Something which probably should be avoided).

Features used

  • repository discovery
  • open repository (without discovery)
  • repository init with options
  • list submodules (like here for example) and open their repo. Assure worktree and submodule APIs are similar.
  • git status (requires index comparison with working tree and head to index)
  • open default git-config, i.e. all config that is global, not local to the repository.
  • add files to index
    • add submodules to index by updating their hash in the index
  • create commit from tree
    • get correct commit signature/actor
    • create tree from index
  • write git configuration (local repository config)
  • check path exists in git index
  • get repository working tree dir
  • Oid::from_hex()
  • Git short hashes/ids
  • Ref name to id
  • check if a path is ignore
  • Rev parse
  • built-in support for the file protocol #734
  • git gc (maybe, for registry) - note that this is shelled out to git, and it's about reducing the amount of pack files which we can already do pretty well I think, and loose objects could be included in the pack as well (even though undeltified)
  • respect fetch.unpackLimit to keep repositories clean (cargo runs gc occasionally as well)
  • git fetch
  • Owned tree objects alongside their owning repository with 'static lifetime (maybe that kind of caching isn't required). They do this with unsafe though.
  • git checkout
  • local clones that hard-link files (and bypass the git protocol) as used in cargo git-dependency checkouts (worktrees would be preferred to me)
  • git hard reset with working tree with progress
  • git submodule update or init + update
  • gitoxide must build (and be tested on) 32 bit systems

Shortcomings of gitoxide in comparison to git2

  • dependencies to binaries make it less usable on windows
    • depends on git binary for file:// protocol due to lack of native upload-pack functionality. Remedy is planned with Rust Foundation grant (stretch goal)
    • depends on ssh binary for ssh connection

Note that replacing clone/fetch related features is tracked in #449 .

Locations and purpose

cd cargo && rg git2:: -l

Potential issues

  • cargo supports 32bit system, which limits mmap to 2Gb usually. For now this is alright but one day cursor based pack access probably needs to be implemented (behind a feature toggle, of course, or automatically configured depending on arch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-integrate-gitoxide "Oxidize" crates even more by replacing git2 with gitoxide
Projects
None yet
Development

No branches or pull requests

1 participant