{"id":17113022,"url":"https://github.com/emmt/ygit","last_synced_at":"2025-03-23T22:28:07.733Z","repository":{"id":227758476,"uuid":"772313578","full_name":"emmt/YGit","owner":"emmt","description":"A Yorick interface to the Git library","archived":false,"fork":false,"pushed_at":"2024-03-16T10:30:00.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T05:41:20.337Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","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/emmt.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":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-03-15T00:15:29.000Z","updated_at":"2024-03-15T00:46:03.000Z","dependencies_parsed_at":"2024-03-15T02:10:47.530Z","dependency_job_id":"b54a87f8-26d2-4779-b4b7-142579556a0a","html_url":"https://github.com/emmt/YGit","commit_stats":null,"previous_names":["emmt/ygit"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmt%2FYGit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmt%2FYGit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmt%2FYGit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmt%2FYGit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emmt","download_url":"https://codeload.github.com/emmt/YGit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245177262,"owners_count":20573071,"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-10-14T17:02:20.993Z","updated_at":"2025-03-23T22:28:07.709Z","avatar_url":"https://github.com/emmt.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A Yorick interface to the Git library\n\nThis repository provides a [Yorick](http://github.com/LLNL/yorick) plug-in to\noperate on Git repositories via the [Git library](https://libgit2.org).\n\nCurrently the plug-in provides very limited capabilities. You can:\n\n- Open a Git repository with `git_repository_open`.\n\n- Retrieve a Git blob object given its SHA-1 hash with `git_blob_lookup` and,\n  then extract its raw content.\n\n\n## Usage\n\nIf the plug-in has been properly installed, it is sufficient to use any\nfunction of the plug-in to automatically load it. You may force the loading of\nthe plug-in by something like:\n\n``` c\n#include \"git.i\"\n```\n\nor\n\n``` c\nrequire, \"git.i\";\n```\n\nin your code.\n\nTo open a Git repository, do:\n\n``` c\nrepo = git_repository_open(dir);\n```\n\nwith `dir` the repository directory. The syntax `repo.dir` yields the name of\nthe repository directory. The resources associated with the Git repository\nobject are automatically released when the object is no longer in use.\n\nA repository object can be used to lookup a blob (the file analog for Git):\n\n``` c\nblob = git_blob_lookup(repos, id);\n```\n\nwith `id` the SHA-1 identifier of the object as a string or as an array of\nbytes. The returned object has the following fields:\n\n``` c\nblob.content // the blob raw content as an array of bytes\nblob.hash    // the SHA-1 hash of the blob data\nblob.oid     // the Object Identifier Data of the blob data\nblob.size    // the number of bytes of the blob raw content\n```\n\nThe resources associated with the Git blob object are automatically released\nwhen the object is no longer in use.\n\nA third optional argument can be provided to `git_blob_lookup`, this argument\nis returned if the blob is not found instead or throwing an error:\n\n``` c\nblob = git_blob_lookup(repos, id, def);\n```\n\nTo compute the SHA-1 identifier of a Git blob whose content is `data` (a\nnumerical array or a scalar string), call:\n\n``` c\nid = git_blob_hash(data, T);\n```\n\nwhere optional argument `T` is `[]` or `char` for a binary identifier, or\n`string` for a textual identifier.\n\nFunctions `git_oid_tostr` and `git_oid_fromstr` can be used to convert between\nthe binary and textual representations of a Git object identifier.\n\nTo load the content of a file:\n\n``` c\ndata = git_file_load(filename, T);\n```\n\nwith `filename` the name of the file and `T` an optional argument: `[]` or\n`char` to read the content as an array of bytes, `string` to read the content\nas a scalar string.\n\nConversely, to save some `data` content (a numerical array or a scalar string),\ncall:\n\n``` c\ngit_file_save, filename, data;\n```\n\n\n## Installation\n\n### Prerequisites\n\nTo install this plug-in, you must have [Yorick](http://github.com/LLNL/yorick),\nGit, and the the [Git library](https://libgit2.org) installed on your machine.\n\n\n### Installation with `EasyYorick`\n\nThe easiest installation is to use\n[`EasyYorick`](https://github.com/emmt/EasyYorick) for installing Yorick and\nthis plug-in (and many others). Assuming `EasyYorick` has been installed,\ninstalling the `YGit` plug-in is as simple as:\n\n``` sh\nypkg upgrade ypkg\nypkg install ygit\n```\n\n\n### Manual installation\n\nIn short, building and installing the plug-in can be as quick as:\n\n``` sh\ncd $BUILD_DIR\n$SRC_DIR/configure\nmake\nmake install\n```\n\nwhere `$BUILD_DIR` is the build directory (at your convenience) and `$SRC_DIR`\nis the source directory of the plug-in code. The build and source directories\ncan be the same in which case, call `./configure` to configure for building.\n\nMore detailed installation explanations are given below.\n\n1. You must have [Yorick](http://github.com/LLNL/yorick), Git, and the [Git\n   library](https://libgit2.org) Git library installed on your machine.\n\n2. Unpack the software code somewhere or clone the Git repository with:\n\n   ```sh\n   git clone https://github.com/emmt/YGit\n   ```\n\n3. Configure for compilation. There are two possibilities:\n\n   For an **in-place build**, go to the source directory, say `$SRC_DIR`, of\n   the plug-in code and run the configuration script:\n\n   ``` sh\n   cd $SRC_DIR\n   ./configure\n   ```\n\n   To see the configuration options, call:\n\n   ``` sh\n   ./configure --help\n   ```\n\n   In particular the options `CPPFLAGS=...`, `CFLAGS=...`, and `LDFLAGS=...` or\n   `--deplibs` may be used to specify additional options for the\n   preprocessor, the compiler, and the linker.\n\n   To compile in a **different build directory**, say `$BUILD_DIR`, create the\n   build directory, go to the build directory and run the configuration script:\n\n   ``` sh\n   mkdir -p $BUILD_DIR\n   cd $BUILD_DIR\n   $SRC_DIR/configure\n   ```\n\n   where `$SRC_DIR` is the path to the source directory of the plug-in code.\n   To see the configuration options, call:\n\n   ``` sh\n   $SRC_DIR/configure --help\n   ```\n\n4. Compile the code:\n\n   ``` sh\n   make\n   ```\n\n4. Install the plug-in in Yorick directories:\n\n   ``` sh\n   make install\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femmt%2Fygit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femmt%2Fygit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femmt%2Fygit/lists"}