Home / Function/ resolve_git_commondir() — tailwindcss Function Reference

resolve_git_commondir() — tailwindcss Function Reference

Architecture documentation for the resolve_git_commondir() function in dir.rs from the tailwindcss codebase.

Function rust OxideEngine PreProcessors calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  27ac4d0f_c908_3282_6a22_e7a8f7917e92["resolve_git_commondir()"]
  510a4ebc_9a2a_672a_2d6d_a56dabd1134b["dir.rs"]
  27ac4d0f_c908_3282_6a22_e7a8f7917e92 -->|defined in| 510a4ebc_9a2a_672a_2d6d_a56dabd1134b
  85a07ccd_8d36_b2b7_e048_c40326822cad["add_child_path()"]
  85a07ccd_8d36_b2b7_e048_c40326822cad -->|calls| 27ac4d0f_c908_3282_6a22_e7a8f7917e92
  8454df73_38f4_e48b_0b1f_ea4663bebcea["next()"]
  27ac4d0f_c908_3282_6a22_e7a8f7917e92 -->|calls| 8454df73_38f4_e48b_0b1f_ea4663bebcea
  style 27ac4d0f_c908_3282_6a22_e7a8f7917e92 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/ignore/src/dir.rs lines 857–898

fn resolve_git_commondir(dir: &Path, git_type: Option<FileType>) -> Result<PathBuf, Option<Error>> {
    let git_dir_path = || dir.join(".git");
    let git_dir = git_dir_path();
    if !git_type.map_or(false, |ft| ft.is_file()) {
        return Ok(git_dir);
    }
    let file = match File::open(git_dir) {
        Ok(file) => io::BufReader::new(file),
        Err(err) => {
            return Err(Some(Error::Io(err).with_path(git_dir_path())));
        }
    };
    let dot_git_line = match file.lines().next() {
        Some(Ok(line)) => line,
        Some(Err(err)) => {
            return Err(Some(Error::Io(err).with_path(git_dir_path())));
        }
        None => return Err(None),
    };
    if !dot_git_line.starts_with("gitdir: ") {
        return Err(None);
    }
    let real_git_dir = PathBuf::from(&dot_git_line["gitdir: ".len()..]);
    let git_commondir_file = || real_git_dir.join("commondir");
    let file = match File::open(git_commondir_file()) {
        Ok(file) => io::BufReader::new(file),
        Err(_) => return Err(None),
    };
    let commondir_line = match file.lines().next() {
        Some(Ok(line)) => line,
        Some(Err(err)) => {
            return Err(Some(Error::Io(err).with_path(git_commondir_file())));
        }
        None => return Err(None),
    };
    let commondir_abs = if commondir_line.starts_with(".") {
        real_git_dir.join(commondir_line) // relative commondir
    } else {
        PathBuf::from(commondir_line)
    };
    Ok(commondir_abs)
}

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does resolve_git_commondir() do?
resolve_git_commondir() is a function in the tailwindcss codebase, defined in crates/ignore/src/dir.rs.
Where is resolve_git_commondir() defined?
resolve_git_commondir() is defined in crates/ignore/src/dir.rs at line 857.
What does resolve_git_commondir() call?
resolve_git_commondir() calls 1 function(s): next.
What calls resolve_git_commondir()?
resolve_git_commondir() is called by 1 function(s): add_child_path.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free