Skip to main content

Module git_path

Module git_path 

Source
Expand description

Git-compatible path normalization and helpers for test-tool path-utils. Logic matches git/path.c (normalize_path_copy, longest_ancestor_length, relative_path, strip_path_suffix) and git/remote.c (relative_url).

Enums§

GitPathError
Errors returned by Git-compatible path helper routines.

Functions§

abspath_part_inside_repo
Git setup.c abspath_part_inside_repo (POSIX).
is_absolute_path_unix
Whether path is an absolute Unix-style path.
longest_ancestor_length
Git’s longest_ancestor_length - normalizes path and each colon-separated prefix.
normalize_path_copy
Purely textual path normalization matching Git’s normalize_path_copy. Returns GitPathError::EscapesRoot when .. would escape above the root (Git returns -1).
prefix_path_gently
Git setup.c prefix_path_gently (POSIX).
real_path_resolving
Like Git’s strbuf_realpath / test-tool path-utils real_path: resolve symlinks by walking path components (so symlink targets are interpreted at each step), then if the leaf is missing, resolve the longest existing prefix and append the remainder.
relative_path
Git’s relative_path from path.c (POSIX subset).
relative_url
Git’s relative_url from remote.c (POSIX; no DOS drive handling).
strip_path_suffix
Git’s stripped_path_suffix_offset / strip_path_suffix.