-
Notifications
You must be signed in to change notification settings - Fork 66
Commit 60f7f94
committed
Fix mkdir race condition in LooseObjectDB.store
This replaces the conditional call to os.mkdir that raises an
unintended FileExistsError if the directory is created between the
check and the os.mkdir call, using a single os.makedirs call
instead, with exist_ok=True.
This way, we attempt creation in a way that produces no error if
the directory is already present, while still raising
FileExistsError if a non-directory filesystem entry (such as a
regular file) is present where we want the directory to be.1 parent d22ac20 commit 60f7f94
1 file changed
+1
-5
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 | - | ||
12 | 11 |
| |
13 | 12 |
| |
14 | 13 |
| |
| |||
33 | 32 |
| |
34 | 33 |
| |
35 | 34 |
| |
36 | - | ||
37 | 35 |
| |
38 | 36 |
| |
39 | - | ||
40 | 37 |
| |
41 | 38 |
| |
42 | 39 |
| |
| |||
222 | 219 |
| |
223 | 220 |
| |
224 | 221 |
| |
225 | - | ||
226 | - | ||
222 | + | ||
227 | 223 |
| |
228 | 224 |
| |
229 | 225 |
| |
|
0 commit comments