module documentation
Safe access to git files.
| Exception | |
File is already locked. |
| Function | ensure |
Ensure a directory exists, creating if necessary. |
| Function | |
Create a file object that obeys the git file locking protocol. |
| Class | _ |
File that follows the git locking protocol for writes. |
| Function | _fancy |
Rename file with temporary backup file to rollback if rename fails. |
Create a file object that obeys the git file locking protocol.
Returns: a builtin file object or a _GitFile object
Note: See _GitFile for a description of the file locking protocol.
Only read-only and write-only (binary) modes are supported; r+, w+, and a are not. To read and write from the same file, you can take advantage of the fact that opening a file for write does not actually open the file you request.
The default file mask makes any created files user-writable and world-readable.
| Parameters | |
filename:str | bytes | os.PathLike[ | Path to the file |
mode:str | File mode (only 'rb' and 'wb' are supported) |
bufsize:int | Buffer size for file operations |
mask:int | File mask for created files |
fsync:bool | Whether to call fsync() before closing (default: True) |
| Returns | |
IO[ | Undocumented |