Skip to content

Commit 61a82a5

Browse files
authored
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 6a6d090)
1 parent 4652d82 commit 61a82a5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Tools/scripts/patchcheck.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ def changed_files(base_branch=None):
9898
cmd += ' --rev qparent'
9999
with subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) as st:
100100
return [x.decode().rstrip() for x in st.stdout]
101-
elif os.path.isdir(os.path.join(SRCDIR, '.git')):
101+
elif os.path.exists(os.path.join(SRCDIR, '.git')):
102+
# We just use an existence check here as:
103+
# directory = normal git checkout/clone
104+
# file = git worktree directory
102105
if base_branch:
103106
cmd = 'git diff --name-status ' + base_branch
104107
else:

0 commit comments

Comments
 (0)