gitoxide icon indicating copy to clipboard operation
gitoxide copied to clipboard

gitoxide in cargo

Open Byron opened this issue 3 years ago • 0 comments

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

  • [x] repository discovery
  • [x] open repository (without discovery)
  • [x] repository init with options
  • [x] 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)
    • [x] untracked files - actually only needs dirwalk, code can be simplified
  • [x] 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
  • [x] create commit from tree
    • [x] get correct commit signature/actor
    • [ ] create tree from index
  • [x] write git configuration (local repository config)
  • [x] check path exists in git index
  • [x] get repository working tree dir
  • [x] Oid::from_hex()
  • [x] Git short hashes/ids
  • [x] Ref name to id
  • [x] check if a path is ignore
  • [x] Rev parse
  • [ ] #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
    • [x] with tags
      • [x] auto-tags
    • [x] anonymous remotes as fetch-handle
    • [x] detect spurious issues and retry
    • [x] control http timeouts
    • [x] respect proxy settings
    • [x] configure user agent
    • [x] make sure remote messages are unbuffered so they are realtime
    • [x] ability to select specific progress messages via stable id
    • [x] non-fast-forward due to crates.io squashing
    • [x] custom authenticator credentials callback
  • [x] Owned tree objects alongside their owning repository with 'static lifetime (maybe that kind of caching isn't required). They do this with unsafe though.
  • [x] 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
  • [x] 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)

Byron avatar Jun 18 '21 04:06 Byron