Is Git Repo Clean
Table of Contents
Intro
What is it?
A simple function that tests whether your git repo is clean.
by clean I mean it has:
- no untracked files
- no staged changes
- no unstaged changes
Installing this also exposes a cli command is-git-repo-clean
Why create it?
I wanted to write a build script that would exit early if the git repo wasn't clean
Install
$ pip install is_git_repo_clean
Usage
programmatic
import is_git_repo_clean
async def isCleanAsync(pathToGitRepo = None):
# async by default
return await is_git_repo_clean.check(pathToGitRepo)
def isCleanSync(pathToGitRepo = None):
# sync available
return is_git_repo_clean.checkSync(pathToGitRepo)
cli
$ is-git-repo-clean --help
Usage
is-git-repo-clean [--dir <path>] [--silent]
is-git-repo-clean --help
is-git-repo-clean --version
Options
dir: path to the git repo to test. Defaults to `os.getcwd()`
silent: disables output
help: print this
version: prints the version of this tool
Returns
<exit code>: <output>
0: yes
1: no
2: <invalid arg message>
3: dir is not a git repository
4: unexpected error occurred <error>
Api
is_git_repo_clean exports the following
check async (dir=os.getcwd()) => bool
- an asynchronous function that returns whether the git repo is clean
checkSync (dir=os.getcwd()) => bool
- a synchronous function that returns whether the git repo is clean
version
Test
hub clone olsonpm/py_is-git-repo-clean
cd py_is-git-repo-clean
python runTests.py
Metadata
Release files for is-git-repo-clean 0.3.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| is_git_repo_clean-0.3.6.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| is_git_repo_clean-0.3.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.8 kB
Release files / is_git_repo_clean-0.3.6.tar.gz
| Download URL | is_git_repo_clean-0.3.6.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
242a6246be18a034f5938d563ecfe0b05ca958cbb84debf6f5713d7931bb7971
|
|
BLAKE2b-256 checksum How to use checksums |
168f262c2f694fbf8bf39505d97d9adbefa122a5d9bab7bf46bbf3e636c9984c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.15 CPython/3.7.3 Linux/5.1.2-arch1-1-ARCH
|
Release files / is_git_repo_clean-0.3.6-py3-none-any.whl
| Download URL | is_git_repo_clean-0.3.6-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e7fee031f4d79ef5f159f44d26dc50100d26c1e563a098c80ace16a55808ecb6
|
|
BLAKE2b-256 checksum How to use checksums |
0b4a89430dad2d58036710747825ddee2b94d1f6fc242eb287eda70dd84d9aaa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.15 CPython/3.7.3 Linux/5.1.2-arch1-1-ARCH
|