@@ -85,35 +85,6 @@ pub(crate) struct GitRunOptions {
8585 pub ( crate ) env : HashMap < String , String > ,
8686}
8787
88- /// The parsed version of Git.
89- #[ derive( Debug , PartialEq , PartialOrd , Eq ) ]
90- pub ( crate ) struct GitVersion ( pub ( crate ) isize , pub ( crate ) isize , pub ( crate ) isize ) ;
91-
92- impl std:: str:: FromStr for GitVersion {
93- type Err = eyre:: Error ;
94-
95- fn from_str ( output : & str ) -> eyre:: Result < GitVersion > {
96- let output = output. trim ( ) ;
97- let words = output. split ( & [ ' ' , '-' ] [ ..] ) . collect :: < Vec < & str > > ( ) ;
98- let version_str = match & words. as_slice ( ) {
99- [ _git, _version, version_str, ..] => version_str,
100- _ => eyre:: bail!( "Could not parse Git version output: {:?}" , output) ,
101- } ;
102- match version_str. split ( '.' ) . collect :: < Vec < & str > > ( ) . as_slice ( ) {
103- [ major, minor, patch, ..] => {
104- let major = major. parse ( ) ?;
105- let minor = minor. parse ( ) ?;
106-
107- // Example version without a real patch number: `2.33.GIT`.
108- let patch: isize = patch. parse ( ) . unwrap_or_default ( ) ;
109-
110- Ok ( GitVersion ( major, minor, patch) )
111- }
112- _ => eyre:: bail!( "Could not parse Git version string: {}" , version_str) ,
113- }
114- }
115- }
116-
11788impl Git {
11889 /// Constructor.
11990 pub ( crate ) fn new ( git_run_info : GitRunInfo , repo_path : PathBuf ) -> Self {
0 commit comments