Created
April 7, 2016 22:28
-
-
Save pcd1193182/3200ea3970daa61969bfcfc511c956f4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 4384827c99cd99e8b92bae738e77fbb8e29cdfce Mon Sep 17 00:00:00 2001 | |
From: Paul Dagnelie <pcd@delphix.com> | |
Date: Wed, 6 Apr 2016 14:25:32 -0700 | |
Subject: [PATCH] DLPX-43865 pbchk throws an error with git rm'd files | |
--- | |
usr/src/tools/scripts/git-pbchk.py | 13 ++++++++----- | |
1 file changed, 8 insertions(+), 5 deletions(-) | |
diff --git a/usr/src/tools/scripts/git-pbchk.py b/usr/src/tools/scripts/git-pbchk.py | |
index 4902cbf..6b75950 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) 2012, 2015 by Delphix. All rights reserved. | |
+# Copyright (c) 2012, 2016 by Delphix. All rights reserved. | |
# | |
import getopt | |
@@ -153,9 +153,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 | |
@@ -190,7 +188,12 @@ 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: | |
+ continue | |
+ empty = not res.readline() | |
+ if (os.path.exists(f) and not empty and select(f) and not exclude(f)): | |
yield f | |
return ret | |
-- | |
2.6.4 (Apple Git-63) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment