summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2017-03-12 10:03:35 (GMT)
committerGitHub <noreply@github.com>2017-03-12 10:03:35 (GMT)
commita6aac8c87036c3180916b893d66b1e257b5e2ec2 (patch)
tree4d7c7de499d03c1de91db0579a652d3cccd68ce0
parentf12f820ef887b009ce70e67e71b8690f30c605ee (diff)
downloadcpython-a6aac8c87036c3180916b893d66b1e257b5e2ec2.zip
cpython-a6aac8c87036c3180916b893d66b1e257b5e2ec2.tar.gz
cpython-a6aac8c87036c3180916b893d66b1e257b5e2ec2.tar.bz2
bpo-29798: Handle git worktree in `make patchcheck` (#629) (#634)
In git worktree directories, `.git` is a configuration file rather than a subdirectory (cherry picked from commit 6a6d090612dd7deaac2bc0399fad743e5e2db606)
-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 7a04aaf..f4ec7d8 100755
--- a/Tools/scripts/patchcheck.py
+++ b/Tools/scripts/patchcheck.py
@@ -98,7 +98,10 @@ def changed_files(base_branch=None):
cmd += ' --rev qparent'
with subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) as st:
return [x.decode().rstrip() for x in st.stdout]
- 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: