Skip to content

Commit 679b8df

Browse files
committed
admin/normalize-index: Remove index squashing code
1 parent 7da20a5 commit 679b8df

File tree

1 file changed

+2
-27
lines changed

1 file changed

+2
-27
lines changed

src/admin/normalize_index.rs

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use std::{
55
};
66

77
use cargo_registry_index::{Repository, RepositoryConfig};
8-
use chrono::Utc;
98
use indicatif::{ProgressBar, ProgressIterator, ProgressStyle};
109

1110
use crate::admin::dialoguer;
@@ -64,38 +63,14 @@ pub fn run(_opts: Opts) -> anyhow::Result<()> {
6463
std::fs::write(path, body)?;
6564
}
6665

67-
let original_head = repo.head_oid()?.to_string();
68-
69-
// Add an additional commit after the squash commit that normalizes the index.
7066
println!("committing normalization");
7167
let msg = "Normalize index format\n\n\
7268
More information can be found at https://github.com/rust-lang/crates.io/pull/5066";
7369
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)?;
8470

8571
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.");
9974
}
10075
Ok(())
10176
}

0 commit comments

Comments
 (0)