{"id":18890024,"url":"https://github.com/git-lfs/gitobj","last_synced_at":"2025-04-05T02:03:39.222Z","repository":{"id":44788197,"uuid":"139863543","full_name":"git-lfs/gitobj","owner":"git-lfs","description":"gitobj reads and writes Git objects.","archived":false,"fork":false,"pushed_at":"2024-08-08T05:18:49.000Z","size":447,"stargazers_count":35,"open_issues_count":0,"forks_count":13,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-29T01:14:11.757Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/git-lfs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-05T14:48:12.000Z","updated_at":"2025-03-01T13:29:36.000Z","dependencies_parsed_at":"2024-01-02T21:40:50.481Z","dependency_job_id":"883d946c-842a-47a7-ac06-f5e9f27c4f8d","html_url":"https://github.com/git-lfs/gitobj","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-lfs%2Fgitobj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-lfs%2Fgitobj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-lfs%2Fgitobj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-lfs%2Fgitobj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/git-lfs","download_url":"https://codeload.github.com/git-lfs/gitobj/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276159,"owners_count":20912288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T07:52:06.918Z","updated_at":"2025-04-05T02:03:39.185Z","avatar_url":"https://github.com/git-lfs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gitobj\n\n[![CI status][ci_badge]][ci_url]\n\n[ci_badge]: https://github.com/git-lfs/gitobj/workflows/CI/badge.svg\n[ci_url]: https://github.com/git-lfs/gitobj/actions?query=workflow%3ACI\n\nPackage `gitobj` reads and writes loose and packed Git objects.\n\n## Getting Started\n\nTo access a repository's objects, begin by \"opening\" that repository for use:\n\n```go\npackage main\n\nimport (\n\t\"github.com/git-lfs/gitobj\"\n)\n\nfunc main() {\n\trepo, err := gitobj.FromFilesystem(\"/path/to/repo.git\", \"\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer repo.Close()\n}\n```\n\nYou can then open objects for inspection with the [`Blob()`][blob],\n[`Commit()`][commit], [`Tag()`][tag], or [`Tree()`][tree] functions:\n\n[blob]: https://godoc.org/github.com/git-lfs/gitobj#ObjectDatabase.Blob\n[commit]: https://godoc.org/github.com/git-lfs/gitobj#ObjectDatabase.Commit\n[tag]: https://godoc.org/github.com/git-lfs/gitobj#ObjectDatabase.Tag\n[tree]: https://godoc.org/github.com/git-lfs/gitobj#ObjectDatabase.Tree\n\n```go\nfunc main() {\n\trepo, err := gitobj.FromFilesystem(\"/path/to/repo.git\", \"\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer repo.Close()\n\n\tcommit, err := repo.Commit([]byte{...})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n\nOnce an object is opened or an instance is held, it can be saved to the object\ndatabase using the [`WriteBlob()`][wblob], [`WriteCommit()`][wcommit],\n[`WriteTag()`][wtag], or [`WriteTree()`][wtree] functions:\n\n[wblob]: https://godoc.org/github.com/git-lfs/gitobj#ObjectDatabase.WriteBlob\n[wcommit]: https://godoc.org/github.com/git-lfs/gitobj#ObjectDatabase.WriteCommit\n[wtag]: https://godoc.org/github.com/git-lfs/gitobj#ObjectDatabase.WriteTag\n[wtree]: https://godoc.org/github.com/git-lfs/gitobj#ObjectDatabase.WriteTree\n\n```go\nfunc main() {\n\trepo, err := gitobj.FromFilesystem(\"/path/to/repo.git\", \"\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer repo.Close()\n\n\tcommit, err := repo.Commit([]byte{...})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tcommit.Message = \"Hello from gitobj!\"\n\tcommit.ExtraHeaders = append(commit.ExtraHeaders, \u0026gitobj.ExtraHeader{\n\t\tK: \"Signed-off-by\",\n\t\tV: \"Jane Doe \u003cjane@example.com\u003e\",\n\t})\n\n\tif _, err := repository.WriteCommit(commit); err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n\n### Packed Objects\n\nPackage `gitobj` has support for reading \"packed\" objects (i.e., objects found\nin [packfiles][1]) via package `github.com/git-lfs/gitobj/pack`. Package `pack`\nimplements searching pack index (`.idx`) files and locating the corresponding\ndelta-base chain in the appropriate `pack` file. It understands both version\n1 and version 2 of the packfile specification.\n\n`gitobj` will always try to locate a loose object first. If a loose object\ncannot be found with the appropriate SHA-1, the repository's packfile(s) will\nbe searched. If an object is located in a packfile, that object will be\nreconstructed along its delta-base chain and then returned transparently.\n\n### More information\n\nFor more: https://godoc.org/github.com/git-lfs/gitobj.\n\n## License\n\nMIT.\n\n[1]: https://git-scm.com/book/en/v2/Git-Internals-Packfiles\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgit-lfs%2Fgitobj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgit-lfs%2Fgitobj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgit-lfs%2Fgitobj/lists"}