@@ -63,7 +63,8 @@ pub fn untracked_files_config_repo(
6363}
6464
6565// see https://git-scm.com/docs/git-config#Documentation/git-config.txt-pushdefault
66- /// represent `push.default` git config
66+ /// represents `push.default` git config
67+ #[ derive( PartialEq , Eq ) ]
6768pub enum PushDefaultStrategyConfig {
6869 Nothing ,
6970 Current ,
@@ -86,11 +87,11 @@ impl<'a> TryFrom<&'a str> for PushDefaultStrategyConfig {
8687 match value {
8788 "nothing" => Ok ( Self :: Nothing ) ,
8889 "current" => Ok ( Self :: Current ) ,
89- "upstream" => Ok ( Self :: Upstream ) ,
90+ "upstream" | "tracking" => Ok ( Self :: Upstream ) ,
9091 "simple" => Ok ( Self :: Simple ) ,
9192 "matching" => Ok ( Self :: Matching ) ,
92- _ => Err ( crate :: Error :: Generic ( format ! (
93- "{ value} is incorrect push.default"
93+ _ => Err ( crate :: Error :: GitConfig ( format ! (
94+ "malformed value for push.default: {value}, must be one of nothing, matching, simple, upstream or current "
9495 ) ) ) ,
9596 }
9697 }
@@ -102,10 +103,7 @@ pub fn push_default_strategy_config_repo(
102103 ( get_config_string_repo ( repo, "push.default" ) ?) . map_or_else (
103104 || Ok ( PushDefaultStrategyConfig :: default ( ) ) ,
104105 |entry_str| {
105- Ok ( PushDefaultStrategyConfig :: try_from (
106- entry_str. as_str ( ) ,
107- )
108- . unwrap_or_default ( ) )
106+ PushDefaultStrategyConfig :: try_from ( entry_str. as_str ( ) )
109107 } ,
110108 )
111109}
0 commit comments