File tree 4 files changed +13
-6
lines changed
git-repository/src/repository
git-revision/src/spec/parse
4 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 1
1
use crate :: Time ;
2
- use bstr:: BStr ;
3
2
4
3
#[ allow( missing_docs) ]
5
- pub fn parse ( input : & BStr ) -> Option < Time > {
4
+ pub fn parse ( input : & str ) -> Option < Time > {
6
5
// TODO: actual implementation, this is just to not constantly fail
7
6
if input == "1979-02-26 18:30:00" {
8
7
Some ( Time :: new ( 42 , 1800 ) )
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ mod parse {
80
80
#[ test]
81
81
fn special_time_is_ok_for_now ( ) {
82
82
assert_eq ! (
83
- git_date:: parse( "1979-02-26 18:30:00" . into ( ) ) . unwrap( ) ,
83
+ git_date:: parse( "1979-02-26 18:30:00" ) . unwrap( ) ,
84
84
Time {
85
85
seconds_since_unix_epoch: 42 ,
86
86
offset_in_seconds: 1800 ,
Original file line number Diff line number Diff line change @@ -126,11 +126,15 @@ impl Personas {
126
126
if git_env. eq ( & git_sec:: Permission :: Allow ) {
127
127
committer_name = committer_name. or_else ( || env_var ( "GIT_COMMITTER_NAME" ) ) ;
128
128
committer_email = committer_email. or_else ( || env_var ( "GIT_COMMITTER_EMAIL" ) ) ;
129
- committer_date = env_var ( "GIT_COMMITTER_DATE" ) . and_then ( |date| git_date:: parse ( date. as_ref ( ) ) ) ;
129
+ committer_date = std:: env:: var ( "GIT_COMMITTER_DATE" )
130
+ . ok ( )
131
+ . and_then ( |date| git_date:: parse ( & date) ) ;
130
132
131
133
author_name = author_name. or_else ( || env_var ( "GIT_AUTHOR_NAME" ) ) ;
132
134
author_email = author_email. or_else ( || env_var ( "GIT_AUTHOR_EMAIL" ) ) ;
133
- author_date = env_var ( "GIT_AUTHOR_DATE" ) . and_then ( |date| git_date:: parse ( date. as_ref ( ) ) ) ;
135
+ author_date = std:: env:: var ( "GIT_AUTHOR_DATE" )
136
+ . ok ( )
137
+ . and_then ( |date| git_date:: parse ( & date) ) ;
134
138
135
139
user_email = user_email. or_else ( || env_var ( "EMAIL" ) ) ; // NOTE: we don't have permission for this specific one…
136
140
}
Original file line number Diff line number Diff line change @@ -432,7 +432,11 @@ where
432
432
Err ( Error :: SiblingBranchNeedsBranchName { name : ( * name) . into ( ) } )
433
433
} ?
434
434
} else if has_ref_or_implied_name {
435
- let time = git_date:: parse ( nav) . ok_or_else ( || Error :: Time { input : nav. into ( ) } ) ?;
435
+ let time = nav
436
+ . to_str ( )
437
+ . ok ( )
438
+ . and_then ( git_date:: parse)
439
+ . ok_or_else ( || Error :: Time { input : nav. into ( ) } ) ?;
436
440
delegate
437
441
. reflog ( delegate:: ReflogLookup :: Date ( time) )
438
442
. ok_or ( Error :: Delegate ) ?;
You can’t perform that action at this time.
0 commit comments