Skip to content

Commit

Permalink
Fix bug where Tinty won't update local templates with custom schemes (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
JamyGolden authored Sep 25, 2024
1 parent e31943d commit ee020f5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Unreleased

### Fixed

- Fix bug where Tinty won't update after custom schemes have been built
in local templates

## [0.19.0] - 2024-09-23

### Added
Expand Down
15 changes: 12 additions & 3 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,20 @@ pub fn git_diff(target_dir: &Path) -> Result<bool> {
.with_context(|| format!("Failed to execute process in {}", target_dir.display()))?;
let stdout = str::from_utf8(&output.stdout).expect("Not valid UTF-8");

// If there is no output, then there is no diff
if stdout.is_empty() {
Ok(false)
} else {
Ok(true)
return Ok(false);
}

// Iterate over the lines and check for changes that should be considered a diff
// Don't consider untracked files a diff
let has_diff = stdout.lines().any(|line| {
let status_code = &line[..2];
// Status codes: M = modified, A = added, ?? = untracked
status_code != "??"
});

Ok(has_diff)
}

pub fn create_theme_filename_without_extension(item: &ConfigItem) -> Result<String> {
Expand Down

0 comments on commit ee020f5

Please sign in to comment.