Metadata-Version: 2.4
Name: cmem-plugin-git
Version: 1.0.0
Summary: Pull and push files from a git Repository.
License: Apache-2.0
License-File: LICENSE
Keywords: eccenca Corporate Memory,plugin
Author: eccenca GmbH
Author-email: cmempy-developer@eccenca.com
Requires-Python: >=3.13,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Plugins
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Dist: cmem-plugin-base (>=4.20.0,<5.0.0)
Requires-Dist: dulwich (>=1.2.14,<2.0.0)
Description-Content-Type: text/markdown

# cmem-plugin-git

Read files from a git repository and commit files back into one.

[![eccenca Corporate Memory][cmem-shield]][cmem-link]

This is a plugin for [eccenca Corporate Memory](https://documentation.eccenca.com). You can install it with the [cmemc](https://eccenca.com/go/cmemc) command line client like this:

```
cmemc admin workspace python install cmem-plugin-git
```

## Tasks

- **List Git files** lists what a repository holds at one revision, without
  transferring any file content.
- **Download Git files** reads the selected files and hands them to the next
  task in the workflow.
- **Upload Git files** commits the files of the preceding task into a folder of
  a repository and pushes them.

All three talk to a repository over HTTP(S) with an access token, work on the
objects of the repository rather than on a checkout, and therefore transfer only
what they were asked for. Git LFS content, SSH remotes, merge and pull requests,
tags and repository history are out of scope. A file uploaded into a path the
repository tracks with Git LFS is committed as ordinary content rather than as
an LFS pointer.

## Access rights

The tasks speak the git HTTP protocol only and never call a forge API, so the
token needs repository access and nothing else.

| Task | GitLab scope | GitHub fine grained token |
| ---- | ------------ | ------------------------- |
| List Git files | `read_repository` | `Contents: Read-only` |
| Download Git files | `read_repository` | `Contents: Read-only` |
| Upload Git files | `write_repository` | `Contents: Read and write` |

A public repository needs no token at all. The user name sent alongside the
token is ignored by GitHub and checked by GitLab, so it defaults to
`gitlab-ci-token`, which GitLab accepts for a repository token. On GitLab the
token's role has to
allow pushing to the target branch as well, which a protected branch restricts
to maintainers by default. **Upload Git files** offers a *Check connection*
action that asks the server for a write handshake without pushing anything, so
an insufficient token shows up while the task is being configured.
  
[![poetry][poetry-shield]][poetry-link] [![ruff][ruff-shield]][ruff-link] [![mypy][mypy-shield]][mypy-link] [![copier][copier-shield]][copier] 

[cmem-link]: https://documentation.eccenca.com
[cmem-shield]: https://img.shields.io/endpoint?url=https://documentation.eccenca.com/latest/badge.json
[poetry-link]: https://python-poetry.org/
[poetry-shield]: https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json
[ruff-link]: https://docs.astral.sh/ruff/
[ruff-shield]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&label=Code%20Style
[mypy-link]: https://mypy-lang.org/
[mypy-shield]: https://www.mypy-lang.org/static/mypy_badge.svg
[copier]: https://copier.readthedocs.io/
[copier-shield]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-purple.json


