|
4 | 4 | """Standalone functions to accompany the index implementation and make it more |
5 | 5 | versatile.""" |
6 | 6 |
|
| 7 | +__all__ = ( |
| 8 | + "write_cache", |
| 9 | + "read_cache", |
| 10 | + "write_tree_from_cache", |
| 11 | + "entry_key", |
| 12 | + "stat_mode_to_index_mode", |
| 13 | + "S_IFGITLINK", |
| 14 | + "run_commit_hook", |
| 15 | + "hook_path", |
| 16 | +) |
| 17 | + |
7 | 18 | from io import BytesIO |
8 | 19 | import os |
9 | 20 | import os.path as osp |
10 | 21 | from pathlib import Path |
11 | | -from stat import ( |
12 | | - S_IFDIR, |
13 | | - S_IFLNK, |
14 | | - S_ISLNK, |
15 | | - S_ISDIR, |
16 | | - S_IFMT, |
17 | | - S_IFREG, |
18 | | - S_IXUSR, |
19 | | -) |
| 22 | +from stat import S_IFDIR, S_IFLNK, S_IFMT, S_IFREG, S_ISDIR, S_ISLNK, S_IXUSR |
20 | 23 | import subprocess |
21 | 24 | import sys |
22 | 25 |
|
| 26 | +from gitdb.base import IStream |
| 27 | +from gitdb.typ import str_tree_type |
| 28 | + |
23 | 29 | from git.cmd import handle_process_output, safer_popen |
24 | 30 | from git.compat import defenc, force_bytes, force_text, safe_decode |
25 | 31 | from git.exc import HookExecutionError, UnmergedEntriesError |
|
29 | 35 | tree_to_stream, |
30 | 36 | ) |
31 | 37 | from git.util import IndexFileSHA1Writer, finalize_process |
32 | | -from gitdb.base import IStream |
33 | | -from gitdb.typ import str_tree_type |
34 | 38 |
|
35 | 39 | from .typ import BaseIndexEntry, IndexEntry, CE_NAMEMASK, CE_STAGESHIFT |
36 | 40 | from .util import pack, unpack |
|
42 | 46 | from git.types import PathLike |
43 | 47 |
|
44 | 48 | if TYPE_CHECKING: |
45 | | - from .base import IndexFile |
46 | 49 | from git.db import GitCmdObjectDB |
47 | 50 | from git.objects.tree import TreeCacheTup |
48 | 51 |
|
49 | | - # from git.objects.fun import EntryTupOrNone |
| 52 | + from .base import IndexFile |
50 | 53 |
|
51 | 54 | # ------------------------------------------------------------------------------------ |
52 | 55 |
|
53 | | - |
54 | 56 | S_IFGITLINK = S_IFLNK | S_IFDIR |
55 | 57 | """Flags for a submodule.""" |
56 | 58 |
|
57 | 59 | CE_NAMEMASK_INV = ~CE_NAMEMASK |
58 | 60 |
|
59 | | -__all__ = ( |
60 | | - "write_cache", |
61 | | - "read_cache", |
62 | | - "write_tree_from_cache", |
63 | | - "entry_key", |
64 | | - "stat_mode_to_index_mode", |
65 | | - "S_IFGITLINK", |
66 | | - "run_commit_hook", |
67 | | - "hook_path", |
68 | | -) |
69 | | - |
70 | 61 |
|
71 | 62 | def hook_path(name: str, git_dir: PathLike) -> str: |
72 | 63 | """:return: path to the given named hook in the given git repository directory""" |
|
0 commit comments