Skip to main content

classify_diff_arg

Function classify_diff_arg 

Source
pub fn classify_diff_arg(arg: &str, repo_root: &Path) -> Result<DiffArg, Error>
Expand description

Classify a diff argument as a snapshot file or git ref.

Detection order:

  1. Existing file on disk -> Snapshot
  2. Path-like arg that doesn’t exist (contains / or .json) -> error (file not found)
  3. git rev-parse --verify <arg> succeeds -> GitRef
  4. Neither -> error