File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ fn get_git_hash_from_nix() -> Option<String> {
57
57
}
58
58
59
59
fn get_git_hash_from_jj ( ) -> Option < String > {
60
- if let Ok ( output ) = Command :: new ( "jj" )
60
+ Command :: new ( "jj" )
61
61
. args ( [
62
62
"--ignore-working-copy" ,
63
63
"--color=never" ,
@@ -67,17 +67,15 @@ fn get_git_hash_from_jj() -> Option<String> {
67
67
"-T=commit_id ++ '-'" ,
68
68
] )
69
69
. output ( )
70
- {
71
- if output. status . success ( ) {
70
+ . ok ( )
71
+ . filter ( |output| output. status . success ( ) )
72
+ . map ( |output| {
72
73
let mut parent_commits = String :: from_utf8 ( output. stdout ) . unwrap ( ) ;
73
74
// If a development version of `jj` is compiled at a merge commit, this will
74
75
// result in several commit ids separated by `-`s.
75
76
parent_commits. truncate ( parent_commits. trim_end_matches ( '-' ) . len ( ) ) ;
76
- return Some ( parent_commits) ;
77
- }
78
- }
79
-
80
- None
77
+ parent_commits
78
+ } )
81
79
}
82
80
83
81
fn get_git_hash_from_git ( ) -> Option < String > {
You can’t perform that action at this time.
0 commit comments