File tree Expand file tree Collapse file tree 2 files changed +4
-19
lines changed Expand file tree Collapse file tree 2 files changed +4
-19
lines changed Original file line number Diff line number Diff line change @@ -480,21 +480,7 @@ fn main() -> Result<()> {
480
480
let mut push_options = git2:: PushOptions :: new ( ) ;
481
481
push_options. remote_callbacks ( callbacks) ;
482
482
483
- // Check if the reference is a tag or branch by inspecting the git repository
484
- let refspec = {
485
- let tag_ref = format ! ( "refs/tags/{}" , base) ;
486
- let is_tag = product_repo
487
- . find_reference ( & tag_ref)
488
- . is_ok ( ) ;
489
-
490
- if is_tag {
491
- format ! ( "{}:refs/tags/{}" , base_commit, base)
492
- } else {
493
- // Assume it's a branch as default behavior
494
- format ! ( "{}:refs/heads/{}" , base_commit, base)
495
- }
496
- } ;
497
-
483
+ let refspec = format ! ( "{}:refs/tags/{}" , base_commit, base) ;
498
484
tracing:: info!( refspec = refspec, "constructed push refspec" ) ;
499
485
500
486
mirror_remote
Original file line number Diff line number Diff line change @@ -176,9 +176,7 @@ pub fn resolve_and_fetch_commitish(
176
176
& [ commitish] ,
177
177
Some (
178
178
FetchOptions :: new ( )
179
- // Tags need to be present to later determine whether `commitish` is a tag or not
180
- // Patchable needs to know this when initializing a repository with the `--mirrored` option (to construct the refspec)
181
- . download_tags ( git2:: AutotagOption :: Auto )
179
+ . update_fetchhead ( true )
182
180
. remote_callbacks ( callbacks)
183
181
// TODO: could be 1, CLI option maybe?
184
182
. depth ( 0 ) ,
@@ -191,7 +189,8 @@ pub fn resolve_and_fetch_commitish(
191
189
refs : vec ! [ commitish. to_string( ) ] ,
192
190
} ) ?;
193
191
tracing:: info!( "fetched base commit" ) ;
194
- repo. revparse_single ( commitish)
192
+ // FETCH_HEAD is written by Remote::fetch to be the last reference fetched
193
+ repo. revparse_single ( "FETCH_HEAD" )
195
194
. and_then ( |obj| obj. peel_to_commit ( ) )
196
195
}
197
196
Err ( err) => Err ( err) ,
You can’t perform that action at this time.
0 commit comments