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(
4747 } )
4848 . status ( )
4949 . 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+
5163 let status = Command :: new ( "git" )
5264 . current_dir ( "rust" )
5365 . arg ( "clean" )
@@ -154,7 +166,20 @@ fn checkout(artifact: &ArtifactId) -> anyhow::Result<()> {
154166 } )
155167 . status ( )
156168 . 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+
158183 } else {
159184 let status = Command :: new ( "git" )
160185 . arg ( "clone" )
You can’t perform that action at this time.
0 commit comments