pub fn resolve_diff_request(
repo: &Repository,
cwd_prefix: Option<&str>,
request: &DiffRequest,
) -> Result<DiffArguments, ResolveDiffArgumentsError>Expand description
Decide what grit diff compares and which paths it is limited to.
Operands before -- that are not revisions but name known paths (in the index, HEAD, or
the working tree) are treated as paths, so grit diff file.txt and grit diff HEAD~1 file.txt work without --. One operand selects a commit’s own patch, or a tree diff for
A..B / A...B (merge base of A and B against B); two operands compare two commits.
With no operands the working tree is compared with HEAD, or with
DiffRequest::against.
Working-tree pathspecs must match a known path; commit and range pathspecs only need to parse, so paths deleted on either side can still be named. An unresolved operand falls back to a working-tree path only when no path operands or pathspec-file entries were supplied; otherwise its revision error is preserved.
§Parameters
repo- repository the revisions and paths belong to.cwd_prefix- path from the work tree root to the process cwd (frompathdiff);Noneat the root, when unknown, or in a bare repository.request- flags and operands as given.
§Errors
- Flag conflicts:
ResolveDiffArgumentsError::StagedAndUnstaged,StagedWithRevisions,UnstagedWithRevisions,TooManyRevisions,AgainstWithCommits,RangeWithSecondRevision. - Revisions:
UnresolvedRevision,NotACommit,NoMergeBase,MultipleMergeBases. - Working tree:
NoWorkTreewhen the target reads the working tree in a bare repository. - Paths:
Pathspec, orLibrarywrappingError::PathspecNoMatch.