diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2012-05-30 09:06:59 +0300 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2012-07-24 21:47:30 +0200 |
commit | 21ac2d83151cd41659af5acf7bcfb130348bcd45 (patch) | |
tree | 0dfea10bbd3743597bc48da1219a6b9c1663b652 /gbp/git | |
parent | ba55f9e1c409aa5b3d7600ed60294fe461d26e78 (diff) |
GitRepository: option to ignore untracked in is_clean()
Add an option to ignore untracked files when checking if the repository
is clean.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp/git')
-rw-r--r-- | gbp/git/repository.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py index f6269c5..02c6c96 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -567,10 +567,13 @@ class GitRepository(object): args += [ commit, '--' ] self._git_command("reset", args) - def is_clean(self): + def is_clean(self, ignore_untracked=False): """ Does the repository contain any uncommitted modifications? + @param ignore_untracked: whether to ignore untracked files when + checking the repository status + @type ignore_untracked: C{bool} @return: C{True} if the repository is clean, C{False} otherwise and Git's status message @rtype: C{tuple} @@ -579,7 +582,13 @@ class GitRepository(object): return (True, '') clean_msg = 'nothing to commit' - out, ret = self._git_getoutput('status', extra_env={'LC_ALL': 'C'}) + + args = GitArgs() + args.add_false(untracked, '-uno') + + out, ret = self._git_getoutput('status', + args.args, + extra_env={'LC_ALL': 'C'}) if ret: raise GbpError("Can't get repository status") ret = False |