summaryrefslogtreecommitdiffstats
path: root/Tools/scripts/patchcheck.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2017-03-12 10:03:45 (GMT)
committerGitHub <noreply@github.com>2017-03-12 10:03:45 (GMT)
commitee10fb9c5b0ae8706bcf7ab70d8d65604f2517a7 (patch)
treeb2f5c3a314dafc12e986723fbcd5052f038fb30d /Tools/scripts/patchcheck.py
parentc8869af89e9b62fbfd066c01da1f502b0fd2ed3f (diff)
downloadcpython-ee10fb9c5b0ae8706bcf7ab70d8d65604f2517a7.zip
cpython-ee10fb9c5b0ae8706bcf7ab70d8d65604f2517a7.tar.gz
cpython-ee10fb9c5b0ae8706bcf7ab70d8d65604f2517a7.tar.bz2
bpo-29798: Handle git worktree in `make patchcheck` (#629) (#635)
In git worktree directories, `.git` is a configuration file rather than a subdirectory (cherry picked from commit 6a6d090612dd7deaac2bc0399fad743e5e2db606)
Diffstat (limited to 'Tools/scripts/patchcheck.py')
-rwxr-xr-xTools/scripts/patchcheck.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Tools/scripts/patchcheck.py b/Tools/scripts/patchcheck.py
index 8a2d906..9f7fb19 100755
--- a/Tools/scripts/patchcheck.py
+++ b/Tools/scripts/patchcheck.py
@@ -105,7 +105,10 @@ def changed_files(base_branch=None):
return [x.decode().rstrip() for x in st.stdout]
finally:
st.stdout.close()
- elif os.path.isdir(os.path.join(SRCDIR, '.git')):
+ elif os.path.exists(os.path.join(SRCDIR, '.git')):
+ # We just use an existence check here as:
+ # directory = normal git checkout/clone
+ # file = git worktree directory
if base_branch:
cmd = 'git diff --name-status ' + base_branch
else: