Tree @46f16bd1-dc21-4fd1-a779-74c83dc075c9/main (Download .tar.gz)
- .github
- debian
- errors
- pack
- script
- storage
- backend.go
- backend_nix.go
- backend_test.go
- backend_windows.go
- blob.go
- blob_test.go
- commit.go
- commit_test.go
- errors.go
- errors_test.go
- file_storer.go
- go.mod
- go.sum
- LICENSE.md
- memory_storer.go
- memory_storer_test.go
- object.go
- object_db.go
- object_db_test.go
- object_reader.go
- object_reader_test.go
- object_type.go
- object_type_test.go
- object_writer.go
- object_writer_test.go
- README.md
- SECURITY.md
- storer.go
- tag.go
- tag_test.go
- tree.go
- tree_test.go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | # gitobj [![](https://travis-ci.org/git-lfs/gitobj.svg?branch=master)](https://travis-ci.org/git-lfs/gitobj) [![](https://godoc.org/github.com/git-lfs/gitobj?status.svg)](https://godoc.org/github.com/git-lfs/gitobj) Package `gitobj` reads and writes loose and packed Git objects. ## Getting Started To access a repository's objects, begin by "opening" that repository for use: ```go package main import ( "github.com/git-lfs/gitobj" ) func main() { repo, err := gitobj.FromFilesystem("/path/to/repo.git", "") if err != nil { panic(err) } defer repo.Close() } ``` You can then open objects for inspection with the [`Blob()`][blob], [`Commit()`][commit], [`Tag()`][tag], or [`Tree()`][tree] functions: [blob]: https://godoc.org/github.com/git-lfs/gitobj#ObjectDatabase.Blob [commit]: https://godoc.org/github.com/git-lfs/gitobj#ObjectDatabase.Commit [tag]: https://godoc.org/github.com/git-lfs/gitobj#ObjectDatabase.Tag [tree]: https://godoc.org/github.com/git-lfs/gitobj#ObjectDatabase.Tree ```go func main() { repo, err := gitobj.FromFilesystem("/path/to/repo.git", "") if err != nil { panic(err) } defer repo.Close() commit, err := repo.Commit([]byte{...}) if err != nil { panic(err) } } ``` Once an object is opened or an instance is held, it can be saved to the object database using the [`WriteBlob()`][wblob], [`WriteCommit()`][wcommit], [`WriteTag()`][wtag], or [`WriteTree()`][wtree] functions: [wblob]: https://godoc.org/github.com/git-lfs/gitobj#ObjectDatabase.WriteBlob [wcommit]: https://godoc.org/github.com/git-lfs/gitobj#ObjectDatabase.WriteCommit [wtag]: https://godoc.org/github.com/git-lfs/gitobj#ObjectDatabase.WriteTag [wtree]: https://godoc.org/github.com/git-lfs/gitobj#ObjectDatabase.WriteTree ```go func main() { repo, err := gitobj.FromFilesystem("/path/to/repo.git", "") if err != nil { panic(err) } defer repo.Close() commit, err := repo.Commit([]byte{...}) if err != nil { panic(err) } commit.Message = "Hello from gitobj!" commit.ExtraHeaders = append(commit.ExtraHeaders, &gitobj.ExtraHeader{ K: "Signed-off-by", V: "Jane Doe <jane@example.com>", }) if _, err := repository.WriteCommit(commit); err != nil { panic(err) } } ``` ### Packed Objects Package `gitobj` has support for reading "packed" objects (i.e., objects found in [packfiles][1]) via package `github.com/git-lfs/gitobj/pack`. Package `pack` implements searching pack index (`.idx`) files and locating the corresponding delta-base chain in the appropriate `pack` file. It understands both version 1 and version 2 of the packfile specification. `gitobj` will always try to locate a loose object first. If a loose object cannot be found with the appropriate SHA-1, the repository's packfile(s) will be searched. If an object is located in a packfile, that object will be reconstructed along its delta-base chain and then returned transparently. ### More information For more: https://godoc.org/github.com/git-lfs/gitobj. ## License MIT. [1]: https://git-scm.com/book/en/v2/Git-Internals-Packfiles |
Commit History @46f16bd1-dc21-4fd1-a779-74c83dc075c9/main
0
»»
- Update changelog for 1.4.1-1 Stephen Gelman 4 years ago
- Update upstream source from tag 'upstream/1.4.1' Stephen Gelman 4 years ago
- New upstream version 1.4.1 Stephen Gelman 4 years ago
- Merge branch 'master' of salsa.debian.org:go-team/packages/golang-github-git-lfs-gitobj Stephen Gelman 4 years ago
- Release 1.3.1-1 Stephen Gelman 4 years ago
- Update d/changelog for 1.3.1 and update standards version and compat level Stephen Gelman 4 years ago
- New upstream version 1.3.1 Stephen Gelman 4 years ago
- Update upstream source from tag 'upstream/1.3.1' Stephen Gelman 4 years ago
- Bump golang dependency to 1.8 or newer Stephen Gelman 5 years ago
- Update d/changelog for 1.0.0-1 Stephen Gelman 5 years ago
- Update upstream source from tag 'upstream/1.0.0' Stephen Gelman 5 years ago
- New upstream version 1.0.0 Stephen Gelman 5 years ago
- Revert "Update debian/watch to check git repo since there are no tags" Stephen Gelman 5 years ago
- Update debian/watch to check git repo since there are no tags Stephen Gelman 5 years ago
- Release 0.0~git20180705.5aa0c18-1 Stephen Gelman 5 years ago
- Initial packaging Stephen Gelman 5 years ago
- New upstream version 0.0~git20180705.5aa0c18 Stephen Gelman 5 years ago
- Ignore quilt dir .pc via .gitignore Stephen Gelman 5 years ago
0
»»