Skip to main content

A simple function to test whether your git repo is clean

Project description

Is Git Repo Clean

Note: This document is best viewed on github. Pypi's markdown headers are all caps which presents innacurate information

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

Options
  dir:      path to the git repo to test.  Defaults to `os.getcwd()`
  silent:   disables output
  help:     print this

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
  • if the directory is not a git repo, then NotAGitRepoException is thrown
checkSync (dir=os.getcwd()) => bool
  • a synchronous function that returns whether the git repo is clean
  • if the directory is not a git repo, then NotAGitRepoException is thrown
NotAGitRepoException
  • A class which inherits Exception which you can handle separately

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.1.6.tar.gz (6.6 kB view hashes)

Uploaded Source

Supported by

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