Skip to content

Gram-ax/git2-lfs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This crate was created as a separated core part of custom LFS spec implementation for Gramax.

You can find complete example of usage here.

Features:

  • Parsing LFS pointer files
  • Writing blobs content to .git/lfs/objects and the corresponding LFS pointer to git object database, and reading them back
  • Pulling and Pushing LFS objects from/to LFS remote over HTTP

Usage

This crate depends on patched git2 crate where bindings for filters API are implemented.

So you have to use the re-exported git2 crate from this crate instead of the original one.

Next, you've to init lfs filter for libgit2.

fn main() {
	// since libgit2 stores registered filters statically, you should call this method only once
	git2_lfs::LfsBuilder::default().install("filter=lfs").unwrap();
}

Now you can use git2 as usual: checkout or add files to the index. File path patterns marked as filter=lfs attribute in .gitattributes file will be handled as lfs object.

Example of .gitattributes:

**/*.png filter=lfs

About

A small and non-complete git lfs spec implementation for git2-rs

Resources

License

Stars

Watchers

Forks

Contributors

Languages