{"id":13395073,"url":"https://github.com/creationix/lua-git","last_synced_at":"2025-04-10T02:44:14.673Z","repository":{"id":33118877,"uuid":"36757811","full_name":"creationix/lua-git","owner":"creationix","description":"Git implementation in pure lua for luvit.","archived":false,"fork":false,"pushed_at":"2023-05-31T22:15:43.000Z","size":20,"stargazers_count":53,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-05-02T06:10:46.835Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/creationix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-06-02T19:49:38.000Z","updated_at":"2023-12-28T00:49:32.000Z","dependencies_parsed_at":"2024-01-13T17:11:40.732Z","dependency_job_id":"49a993fa-e2cd-4f44-94c0-8ab0535985bc","html_url":"https://github.com/creationix/lua-git","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creationix%2Flua-git","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creationix%2Flua-git/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creationix%2Flua-git/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creationix%2Flua-git/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/creationix","download_url":"https://codeload.github.com/creationix/lua-git/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248145663,"owners_count":21055180,"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-07-30T17:01:41.116Z","updated_at":"2025-04-10T02:44:14.651Z","avatar_url":"https://github.com/creationix.png","language":"Lua","funding_links":[],"categories":["Lua"],"sub_categories":[],"readme":"# lua-git\n\nGit implementation in pure lua for luvit.\n\n## Get Git\n\nInstall using the [lit](https://github.com/luvit/lit) toolkit.\n\n```sh\nlit install creationix/git\n```\n\n## git.mount(fs) -\u003e db\n\nThe primary interface to the git module is a mount command that accepts a fs\ninterface instance and returns a git database.  Under the hood it mounts a git\nrepository using the same filesystem format as the native git tool.  This\nincludes support for reading packed objects and refs.\n\nThe `fs` interface is required to implement the same API as a coro-fs chroot that\nis rooted at the database root.\n\n```lua\nlocal import = _G.import or require\n\nlocal makeChroot = import('coro-fs').chroot\nlocal mount = import('git').mount\n\nlocal db = mount(makeChroot(\"path/to/.git\"))\n\n--[[\ndb.has(hash) -\u003e bool             - check if db has an object\ndb.load(hash) -\u003e raw             - load raw data, nil if not found\ndb.loadAny(hash) -\u003e kind, value  - pre-decode data, error if not found\ndb.loadAs(kind, hash) -\u003e value   - pre-decode and check type or error\ndb.save(raw) -\u003e hash             - save pre-encoded and framed data\ndb.saveAs(kind, value) -\u003e hash   - encode, frame and save to objects/$ha/$sh\ndb.hashes() -\u003e iter              - Iterate over all hashes\n\ndb.getHead() -\u003e hash             - Read the hash via HEAD\ndb.getRef(ref) -\u003e hash           - Read hash of a ref\ndb.resolve(ref) -\u003e hash          - Resolve hash, tag, branch, or \"HEAD\" to hash\ndb.nodes(prefix) -\u003e iter         - iterate over non-leaf refs\ndb.leaves(prefix) -\u003e iter        - iterate over leaf refs\n\ndb.storage                       - table containing storage interface.\n\nstorage.write(path, raw)         - Write mutable data by path\nstorage.put(path, raw)           - Write immutable data by path\nstorage.read(path) -\u003e raw        - Read mutable data by path (nil if not found)\nstorage.delete(path)             - Delete an entry (removes empty parent dirs)\nstorage.nodes(path) -\u003e iter      - Iterate over node children of path\n                                   (empty iter if not found)\nstorage.leaves(path) -\u003e iter     - Iterate over node children of path\n                                   (empty iter if not found)\n\nstorage.fs                       - The fs instance originally passed in.\n]]\n```\n\n## git.modes\n\nThe modes table contains constants and helpers for working with git tree entry modes.\n\nTODO: show example usage.\n\n## git.encoders\n\nThis table contains the internal encoder functions for constructing the binary\nrepresentation of git objects.\n\n## git.decoders\n\nThis table contains decoders for reading binary git objects into lua.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreationix%2Flua-git","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcreationix%2Flua-git","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreationix%2Flua-git/lists"}