@@ -5,7 +5,6 @@ use std::{
5
5
} ;
6
6
7
7
use cargo_registry_index:: { Repository , RepositoryConfig } ;
8
- use chrono:: Utc ;
9
8
use indicatif:: { ProgressBar , ProgressIterator , ProgressStyle } ;
10
9
11
10
use crate :: admin:: dialoguer;
@@ -64,38 +63,14 @@ pub fn run(_opts: Opts) -> anyhow::Result<()> {
64
63
std:: fs:: write ( path, body) ?;
65
64
}
66
65
67
- let original_head = repo. head_oid ( ) ?. to_string ( ) ;
68
-
69
- // Add an additional commit after the squash commit that normalizes the index.
70
66
println ! ( "committing normalization" ) ;
71
67
let msg = "Normalize index format\n \n \
72
68
More information can be found at https://github.com/rust-lang/crates.io/pull/5066";
73
69
repo. run_command ( Command :: new ( "git" ) . args ( [ "commit" , "-am" , msg] ) ) ?;
74
- let snapshot_head = repo. head_oid ( ) ?. to_string ( ) ;
75
-
76
- println ! ( "squashing" ) ;
77
- let now = Utc :: now ( ) . format ( "%Y-%m-%d" ) ;
78
- let msg = format ! ( "Collapse index into one commit\n \n \
79
- Previous HEAD was {}, now on the `snapshot-{}` branch\n \n \
80
- More information about this change can be found [online] and on [this issue].\n \n \
81
- [online]: https://internals.rust-lang.org/t/cargos-crate-index-upcoming-squash-into-one-commit/8440\n \
82
- [this issue]: https://github.com/rust-lang/crates-io-cargo-teams/issues/47", snapshot_head, now) ;
83
- repo. squash_to_single_commit ( & msg) ?;
84
70
85
71
if dialoguer:: confirm ( "push to origin?" ) {
86
- repo. run_command ( Command :: new ( "git" ) . args ( [
87
- "push" ,
88
- // Both updates should succeed or fail together
89
- "--atomic" ,
90
- "origin" ,
91
- // Overwrite master, but only if it server matches the expected value
92
- & format ! ( "--force-with-lease=refs/heads/master:{original_head}" ) ,
93
- // The new squashed commit is pushed to master
94
- "HEAD:refs/heads/master" ,
95
- // The previous value of HEAD is pushed to a snapshot branch
96
- & format ! ( "{snapshot_head}:refs/heads/snapshot-{now}" ) ,
97
- ] ) ) ?;
98
- println ! ( "The index has been successfully normalized and squashed." ) ;
72
+ repo. run_command ( Command :: new ( "git" ) . args ( [ "push" , "origin" ] ) ) ?;
73
+ println ! ( "The index has been successfully normalized." ) ;
99
74
}
100
75
Ok ( ( ) )
101
76
}
0 commit comments