diff options
author | Christian Duerr <contact@christianduerr.com> | 2023-12-28 18:57:30 +0100 |
---|---|---|
committer | Christian Duerr <contact@christianduerr.com> | 2024-01-06 08:59:54 +0100 |
commit | 047152acb891c395d4280e4bbdc9e6df9eb23f0e (patch) | |
tree | fc43be24a7d64c1f62e25253e044e55bae095d29 | |
parent | 8465c2e6df2bc83bac4ee3a8c86383a5b9192ecf (diff) | |
download | alacritty-047152acb891c395d4280e4bbdc9e6df9eb23f0e.tar.gz alacritty-047152acb891c395d4280e4bbdc9e6df9eb23f0e.zip |
Fix `alacritty migrate` with nonexistent imports
Fixes #7473.
-rw-r--r-- | CHANGELOG.md | 6 | ||||
-rw-r--r-- | alacritty/src/migrate.rs | 18 |
2 files changed, 23 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index f7ebbb00..f68cb5ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ The sections should follow the order `Packaging`, `Added`, `Changed`, `Fixed` an The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## 0.13.1-rc1 + +### Fixed + +- `alacritty migrate` failing with nonexistent imports + ## 0.13.0 ### Packaging diff --git a/alacritty/src/migrate.rs b/alacritty/src/migrate.rs index 4d632af4..5f47b083 100644 --- a/alacritty/src/migrate.rs +++ b/alacritty/src/migrate.rs @@ -96,7 +96,7 @@ fn migrate_config( if options.dry_run && !options.silent { // Output new content to STDOUT. println!( - "\nv-----Start TOML for {path:?}-----v\n\n{toml}\n^-----End TOML for {path:?}-----^" + "\nv-----Start TOML for {path:?}-----v\n\n{toml}\n^-----End TOML for {path:?}-----^\n" ); } else if !options.dry_run { // Write the new toml configuration. @@ -124,7 +124,23 @@ fn migrate_imports( Ok(import) => import, Err(err) => return Err(format!("import error: {err}")), }; + + // Keep yaml import if path does not exist. + if !import.exists() { + if options.dry_run { + eprintln!("Keeping yaml config for nonexistent import: {import:?}"); + } + new_imports.push(Value::String(import.to_string_lossy().into())); + continue; + } + let new_path = migrate_config(options, &import, recursion_limit - 1)?; + + // Print new import path. + if options.dry_run { + println!("Successfully migrated import {import:?} to {new_path:?}"); + } + new_imports.push(Value::String(new_path)); } |