Skip to main content

parse_path_line

Function parse_path_line 

Source
pub fn parse_path_line(stdout: &[u8]) -> Option<PathBuf>
Expand description

What: The path text git var GIT_CONFIG_SYSTEM printed, when it is one absolute path on one line. Why: Any other output (nothing, a relative path, several lines) is not a fact the readers can use.

In TS you’d write (pseudocode):

const path = stdout.endsWith('\n') && !stdout.slice(0, -1).includes('\n') && isAbsolute(stdout.slice(0, -1)) ? stdout.slice(0, -1) : undefined;