summaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2017-03-12 20:00:20 +1000
committerGitHub <noreply@github.com>2017-03-12 20:00:20 +1000
commit61a82a5fbf1a674b91764652ab70f5dbb9ba50f2 (patch)
tree3e1c8a51b35050aa65466bb67b4289eea057f758 /Tools
parent4652d82a51e6530a4f820588a6209d3295963bdb (diff)
downloadcpython-git-61a82a5fbf1a674b91764652ab70f5dbb9ba50f2.tar.gz
bpo-29798: Handle git worktree in `make patchcheck` (#629) (#633)
In git worktree directories, `.git` is a configuration file rather than a subdirectory (cherry picked from commit 6a6d090612dd7deaac2bc0399fad743e5e2db606)
Diffstat (limited to 'Tools')
-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 7a04aafa82..f4ec7d8a30 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: