Commit b5d86a1
Clarify Git.execute() string semantics on Windows and shlex caveat
gitpython-developers#2144 stated that with shell=False, a string command is passed as a
single executable name. That is correct on POSIX, but on Windows
subprocess.Popen forwards the string to CreateProcessW and Windows
command-line parsing rules produce the program's argv. So a
multi-word command string like "git version" actually runs on
Windows.
It also recommended shlex.split() for tokenizing a string into
argv. The shlex module is intended only for Unix shells; its
tokenization can diverge from Windows command-line conventions,
with possible security implications when the input is not fully
trusted.
Rewrite the :param command: block to keep gitpython-developers#2144's recommendation
to use the sequence form and its helpful POSIX failure-mode
example, add an explicit Windows bullet describing the OS-side
parsing, and note shlex.split's POSIX-only nature. This is
documentation only; behavior is unchanged.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 7b83f7a commit b5d86a1
1 file changed
Lines changed: 26 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1131 | 1131 | | |
1132 | 1132 | | |
1133 | 1133 | | |
1134 | | - | |
1135 | | - | |
1136 | | - | |
1137 | | - | |
1138 | | - | |
1139 | | - | |
1140 | | - | |
1141 | | - | |
1142 | | - | |
1143 | | - | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
1144 | 1160 | | |
1145 | 1161 | | |
1146 | 1162 | | |
| |||
0 commit comments