Commit 3e829eb
committed
util: close lockfile after opening successfully
Otherwise, this will leak file handles and can be a problem in Windows.
Also, `closefd=true` is the default here, so need to pass it explicitly.
Regression from #1619.
I noticed after [our tests started raising `ResourceWarning`][1].
```python
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.8.17/x64/lib/python3.8/site-packages/git/util.py", line 938, in _obtain_lock_or_raise
open(lock_file, mode='w', closefd=True)
ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/pytest-of-runner/pytest-0/popen-gw0/external0/project.git/.git/config.lock' mode='w' encoding='UTF-8'>
```
[1]: https://github.com/iterative/dvc/actions/runs/6055520480/job/16434544764#step:6:8691 parent f882cd8 commit 3e829eb
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
935 | 935 | | |
936 | 936 | | |
937 | 937 | | |
938 | | - | |
| 938 | + | |
| 939 | + | |
939 | 940 | | |
940 | 941 | | |
941 | 942 | | |
| |||
0 commit comments