Skip to main content

A simple function to test whether your git repo is clean

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

is_git_repo_clean-0.3.5.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

is_git_repo_clean-0.3.5-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file is_git_repo_clean-0.3.5.tar.gz.

File metadata

  • Download URL: is_git_repo_clean-0.3.5.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.11 CPython/3.7.3 Linux/5.0.6-arch1-1-ARCH

File hashes

Hashes for is_git_repo_clean-0.3.5.tar.gz
Algorithm Hash digest
SHA256 0243f6a36fb93bb5ed5d4af56da74f387d0d2b3fa6e43c27b73988c861880a93
MD5 9db1e1e9a62d7e742e2987f6d49c3015
BLAKE2b-256 b3620bdc3235dd6dd11a741c86bb2d4fac2ec5fd8303feede3b773376f1e22bb

See more details on using hashes here.

File details

Details for the file is_git_repo_clean-0.3.5-py3-none-any.whl.

File metadata

  • Download URL: is_git_repo_clean-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.11 CPython/3.7.3 Linux/5.0.6-arch1-1-ARCH

File hashes

Hashes for is_git_repo_clean-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2b37a2e62eb6f2fae0cd88824f82d92cbe1bd7b21be74184c9f39cdd9e1296cb
MD5 9674c7ee177205356164941ceaa77032
BLAKE2b-256 82b0a716973a38611b69d6cb45019927403f32bb88c85ef4e085bd9992d0e3bc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page