MCPcopy Create free account
hub / github.com/dashed/git-chain / dirty_working_directory

Method dirty_working_directory

src/git_chain/core.rs:331–346  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

329 }
330
331 pub fn dirty_working_directory(&self) -> Result<bool, Error> {
332 // perform equivalent to git diff-index HEAD
333 let obj = self.repo.revparse_single("HEAD")?;
334 let tree = obj.peel(ObjectType::Tree)?;
335
336 let diff = self
337 .repo
338 .diff_tree_to_workdir_with_index(tree.as_tree(), None)?;
339
340 let diff_stats = diff.stats()?;
341 let has_changes = diff_stats.files_changed() > 0
342 || diff_stats.insertions() > 0
343 || diff_stats.deletions() > 0;
344
345 Ok(has_changes)
346 }
347}

Callers 3

backupMethod · 0.80
preliminary_checksMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected