File tree Expand file tree Collapse file tree 4 files changed +10
-16
lines changed
Expand file tree Collapse file tree 4 files changed +10
-16
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ These defaults require some adoption from existing users but feel more natural t
3535### Fixes
3636* stash window empty after file history popup closes ([ #1986 ] ( https://github.com/extrawurst/gitui/issues/1986 ) )
3737* allow push to empty remote ([ #1919 ] ( https://github.com/extrawurst/gitui/issues/1919 ) )
38+ * better diagnostics for theme file loading ([ #2007 ] ( https://github.com/extrawurst/gitui/issues/2007 ) )
3839
3940## [ 0.24.3] - 2023-09-09
4041
Original file line number Diff line number Diff line change @@ -121,7 +121,6 @@ pub fn tag_commit(
121121
122122#[ cfg( test) ]
123123mod tests {
124-
125124 use crate :: error:: Result ;
126125 use crate :: sync:: tags:: Tag ;
127126 use crate :: sync:: RepoPath ;
Original file line number Diff line number Diff line change @@ -48,11 +48,7 @@ pub fn process_cmdline() -> Result<CliArgs> {
4848 . get_one :: < String > ( "theme" )
4949 . map_or_else ( || PathBuf :: from ( "theme.ron" ) , PathBuf :: from) ;
5050
51- let theme = if get_app_config_path ( ) ?. join ( & arg_theme) . is_file ( ) {
52- get_app_config_path ( ) ?. join ( arg_theme)
53- } else {
54- get_app_config_path ( ) ?. join ( "theme.ron" )
55- } ;
51+ let theme = get_app_config_path ( ) ?. join ( arg_theme) ;
5652
5753 let notify_watcher: bool =
5854 * arg_matches. get_one ( "watcher" ) . unwrap_or ( & false ) ;
@@ -82,10 +78,11 @@ fn app() -> ClapApp {
8278 )
8379 . arg (
8480 Arg :: new ( "theme" )
85- . help ( "Set the color theme (defaults to theme.ron) " )
81+ . help ( "Set color theme filename loaded from config directory " )
8682 . short ( 't' )
8783 . long ( "theme" )
88- . value_name ( "THEME" )
84+ . value_name ( "THEME_FILE" )
85+ . default_value ( "theme.ron" )
8986 . num_args ( 1 ) ,
9087 )
9188 . arg (
Original file line number Diff line number Diff line change @@ -274,13 +274,7 @@ impl Theme {
274274 fn load_patch ( theme_path : & PathBuf ) -> Result < ThemePatch > {
275275 let file = File :: open ( theme_path) ?;
276276
277- let load_result = ron:: de:: from_reader ( file) ;
278-
279- if let Err ( e) = & load_result {
280- log:: error!( "theme error [{:?}]: {e}" , theme_path) ;
281- }
282-
283- Ok ( load_result?)
277+ Ok ( ron:: de:: from_reader ( file) ?)
284278 }
285279
286280 fn load_old_theme ( theme_path : & PathBuf ) -> Result < Self > {
@@ -303,7 +297,10 @@ impl Theme {
303297 pub fn init ( theme_path : & PathBuf ) -> Self {
304298 let mut theme = Self :: default ( ) ;
305299
306- if let Ok ( patch) = Self :: load_patch ( theme_path) {
300+ if let Ok ( patch) = Self :: load_patch ( theme_path) . map_err ( |e| {
301+ log:: error!( "theme error [{:?}]: {e}" , theme_path) ;
302+ e
303+ } ) {
307304 theme. apply ( patch) ;
308305 } else if let Ok ( old_theme) = Self :: load_old_theme ( theme_path)
309306 {
You can’t perform that action at this time.
0 commit comments