diff options
author | Paul Dagnelie <pcd@delphix.com> | 2016-04-14 15:44:14 -0700 |
---|---|---|
committer | Matthew Ahrens <mahrens@delphix.com> | 2016-04-15 09:45:27 -0700 |
commit | 93d2a904d17ac0073fa98bf62f89294d980c8b3d (patch) | |
tree | 753fdc00feaf9f991312f490dc97e9c8a97dfdc2 /usr/src/tools/scripts/git-pbchk.py | |
parent | 215198a6ad15cf4832370e2f19247abeb36b951a (diff) | |
download | illumos-gate-93d2a904d17ac0073fa98bf62f89294d980c8b3d.tar.gz |
6913 pbchk throws an error with git rm'd files
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src/tools/scripts/git-pbchk.py')
-rw-r--r-- | usr/src/tools/scripts/git-pbchk.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/usr/src/tools/scripts/git-pbchk.py b/usr/src/tools/scripts/git-pbchk.py index def3b2617e..ce016b684d 100644 --- a/usr/src/tools/scripts/git-pbchk.py +++ b/usr/src/tools/scripts/git-pbchk.py @@ -19,7 +19,7 @@ # Copyright 2008, 2012 Richard Lowe # Copyright 2014 Garrett D'Amore <garrett@damore.org> # Copyright (c) 2014, Joyent, Inc. -# Copyright (c) 2015 by Delphix. All rights reserved. +# Copyright (c) 2015, 2016 by Delphix. All rights reserved. # import getopt @@ -164,9 +164,7 @@ def git_file_list(parent, paths=None): ret = set() for fname in p: - res = git("diff %s HEAD %s" % (parent, fname)) - empty = not res.readline() - if fname and not fname.isspace() and fname not in ret and not empty: + if fname and not fname.isspace() and fname not in ret: ret.add(fname.strip()) return ret @@ -201,7 +199,17 @@ def gen_files(root, parent, paths, exclude): for f in git_file_list(parent, paths): f = relpath(f, '.') - if (os.path.exists(f) and select(f) and not exclude(f)): + try: + res = git("diff %s HEAD %s" % (parent, f)) + except GitError, e: + # This ignores all the errors that can be thrown. Usually, this means + # that git returned non-zero because the file doesn't exist, but it + # could also fail if git can't create a new file or it can't be + # executed. Such errors are 1) unlikely, and 2) will be caught by other + # invocations of git(). + continue + empty = not res.readline() + if (os.path.exists(f) and not empty and select(f) and not exclude(f)): yield f return ret |