Thanks for checking out git-dummy and for your interest in contributing!
- ⭐ Star the repo
- Open an issue: a bug, a repository shape you need, or even a small friction or a confusing message
- Tell people about git-dummy, especially anyone writing Git tutorials or testing Git tools
- Contribute code, as described below
Please check existing issues first, then open a new one with:
- The command you ran (or your recipe file), and what you expected to get
- What you got instead, with any error message
- Your git-dummy version (
pip show git-dummy), Git version (git --version), Python version, and operating system
git-dummy ... --print-script prints the exact git commands a build runs, which often shows where it went wrong.
Open an issue describing the repository you need and what you'd use it for: a tutorial, a test, a demo. If it's a situation people get into in real repositories, it might make a good named scenario.
You need Python 3.8 or later, and Git 2.28 or later.
- Fork the repository and clone your fork
- Create a virtual environment and install git-dummy from source, with YAML support and pytest:
$ cd path/to/git-dummy
$ python -m venv .venv
$ source .venv/bin/activate # Windows: .venv\Scripts\activate
$ python -m pip install -e ".[yaml]" pytestThe editable install (-e) means your changes take effect as soon as you save. If you had installed git-dummy with pip before, pip uninstall git-dummy first.
- Build a repo with your local copy:
$ git-dummy --scenario merge-conflict --git-dir /tmpgit_dummy/spec.py: every option, in oneSpecshared by the command line, the Python API, recipe files, and scenariosgit_dummy/builder.py: builds the repository aSpecdescribes, or records it as a shell script for--print-scriptgit_dummy/scenarios.py: the named scenariosgit_dummy/content.py: the realistic files, commit messages, and authorsgit_dummy/__main__.py: the command line
$ pytest testsTwo things the tests protect, which a change must keep:
- The classic ids don't change. A plain build with
--constant-shamust produce the same commit ids as git-dummy 0.1.2, byte for byte. git-sim's test fixtures depend on them. - The same seed builds the same repository. Seeded builds are reproducible, so documentation and tests can show their commit ids.
If you work on git-sim too, run its validation suite (pytest tests/validation in git-sim) with git-dummy checked out beside it. It builds every repository shape it tests from your local git-dummy.
- Add an entry to
SCENARIOSingit_dummy/scenarios.py, with a_docline that says what situation it sets up - Add a row to the Scenarios table in the README
- Add a test that builds it and checks the state it promises
Match the code around your change: its naming, its comment density, and its idioms. The codebase isn't formatted with a single tool, so don't run a formatter over whole files, which would bury your change in unrelated edits.
- Write commit messages in the imperative mood: "Add", "Fix", "Build", not "Added" or "Fixes"
- Sign off your commits with
-s, which adds aSigned-off-bytrailer:
$ git commit -s -m "Add a scenario for a rebase stopped on a conflict"- Push to your fork and open a pull request against
main, saying what changed and how you tested it.
Feel free to email me at jacob@initialcommit.io with any questions about contributing.