@@ -37,7 +37,7 @@ fn record(
37
37
aid : database:: ArtifactIdNumber ,
38
38
) -> anyhow:: Result < ( ) > {
39
39
let checkout = Path :: new ( "rust" ) ;
40
- let status = Command :: new ( "git" )
40
+ let mut status = Command :: new ( "git" )
41
41
. current_dir ( "rust" )
42
42
. arg ( "reset" )
43
43
. arg ( "--hard" )
@@ -48,17 +48,17 @@ fn record(
48
48
. status ( )
49
49
. context ( "git reset --hard" ) ?;
50
50
51
- if !status. success ( ) {
51
+ if !status. success ( ) && matches ! ( artifact , ArtifactId :: Artifact ( _ ) ) {
52
52
log:: warn!( "git reset --hard {} failed - trying default branch" , artifact) ;
53
- let status = Command :: new ( "git" )
53
+ status = Command :: new ( "git" )
54
54
. current_dir ( "rust" )
55
55
. arg ( "reset" )
56
56
. arg ( "--hard" )
57
57
. arg ( "origin/HEAD" )
58
58
. status ( )
59
59
. context ( "git reset --hard" ) ?;
60
- assert ! ( status. success( ) , "git reset --hard successful" ) ;
61
60
}
61
+ assert ! ( status. success( ) , "git reset --hard successful" ) ;
62
62
63
63
let status = Command :: new ( "git" )
64
64
. current_dir ( "rust" )
@@ -156,7 +156,7 @@ fn record(
156
156
157
157
fn checkout ( artifact : & ArtifactId ) -> anyhow:: Result < ( ) > {
158
158
if Path :: new ( "rust" ) . exists ( ) {
159
- let status = Command :: new ( "git" )
159
+ let mut status = Command :: new ( "git" )
160
160
. current_dir ( "rust" )
161
161
. arg ( "fetch" )
162
162
. arg ( "origin" )
@@ -167,18 +167,17 @@ fn checkout(artifact: &ArtifactId) -> anyhow::Result<()> {
167
167
. status ( )
168
168
. context ( "git fetch origin" ) ?;
169
169
170
- if !status. success ( ) {
170
+ if !status. success ( ) && matches ! ( artifact , ArtifactId :: Artifact ( _ ) ) {
171
171
log:: warn!( "git fetch origin {} failed - trying default branch" , artifact) ;
172
- let status = Command :: new ( "git" )
172
+ status = Command :: new ( "git" )
173
173
. current_dir ( "rust" )
174
174
. arg ( "fetch" )
175
175
. arg ( "origin" )
176
176
. arg ( "HEAD" )
177
177
. status ( )
178
178
. context ( "git fetch origin HEAD" ) ?;
179
-
180
- assert ! ( status. success( ) , "git fetch successful" ) ;
181
179
}
180
+ assert ! ( status. success( ) , "git fetch successful" ) ;
182
181
183
182
} else {
184
183
let status = Command :: new ( "git" )
0 commit comments