bpo-29798: Handle git worktree in make patchcheck (#629) (#635) · python/cpython@ee10fb9 (original) (raw)

Original file line number Diff line number Diff line change
@@ -105,7 +105,10 @@ def changed_files(base_branch=None):
105 105 return [x.decode().rstrip() for x in st.stdout]
106 106 finally:
107 107 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
109 112 if base_branch:
110 113 cmd = 'git diff --name-status ' + base_branch
111 114 else: