Skip to content

Commit ee10fb9

Browse files
authored
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 6a6d090)
1 parent c8869af commit ee10fb9

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
@@ -105,7 +105,10 @@ def changed_files(base_branch=None):
105105
return [x.decode().rstrip() for x in st.stdout]
106106
finally:
107107
st.stdout.close()
108-
elif os.path.isdir(os.path.join(SRCDIR, '.git')):
108+
elif os.path.exists(os.path.join(SRCDIR, '.git')):
109+
# We just use an existence check here as:
110+
# directory = normal git checkout/clone
111+
# file = git worktree directory
109112
if base_branch:
110113
cmd = 'git diff --name-status ' + base_branch
111114
else:

0 commit comments

Comments
 (0)