File tree Expand file tree Collapse file tree 1 file changed +27
-2
lines changed Expand file tree Collapse file tree 1 file changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,19 @@ fn record(
47
47
} )
48
48
. status ( )
49
49
. context ( "git reset --hard" ) ?;
50
- assert ! ( status. success( ) , "git reset --hard successful" ) ;
50
+
51
+ if !status. success ( ) {
52
+ log:: warn!( "git reset --hard {} failed - trying default branch" , artifact) ;
53
+ let status = Command :: new ( "git" )
54
+ . current_dir ( "rust" )
55
+ . arg ( "reset" )
56
+ . arg ( "--hard" )
57
+ . arg ( "origin/HEAD" )
58
+ . status ( )
59
+ . context ( "git reset --hard" ) ?;
60
+ assert ! ( status. success( ) , "git reset --hard successful" ) ;
61
+ }
62
+
51
63
let status = Command :: new ( "git" )
52
64
. current_dir ( "rust" )
53
65
. arg ( "clean" )
@@ -154,7 +166,20 @@ fn checkout(artifact: &ArtifactId) -> anyhow::Result<()> {
154
166
} )
155
167
. status ( )
156
168
. context ( "git fetch origin" ) ?;
157
- assert ! ( status. success( ) , "git fetch successful" ) ;
169
+
170
+ if !status. success ( ) {
171
+ log:: warn!( "git fetch origin {} failed - trying default branch" , artifact) ;
172
+ let status = Command :: new ( "git" )
173
+ . current_dir ( "rust" )
174
+ . arg ( "fetch" )
175
+ . arg ( "origin" )
176
+ . arg ( "HEAD" )
177
+ . status ( )
178
+ . context ( "git fetch origin HEAD" ) ?;
179
+
180
+ assert ! ( status. success( ) , "git fetch successful" ) ;
181
+ }
182
+
158
183
} else {
159
184
let status = Command :: new ( "git" )
160
185
. arg ( "clone" )
You can’t perform that action at this time.
0 commit comments