Skip to content

Commit

Permalink
refactor: remove leftover of rust-lang#6880
Browse files Browse the repository at this point in the history
The relevant part was removed in 1daff03
LAST_UPDATED_FILE was never used even before rust-lang#6880.
They were just leftover during the PR updates.
  • Loading branch information
weihanglo committed Jun 9, 2023
1 parent ea75774 commit 768708f
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/cargo/sources/registry/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,9 @@ impl<'cfg> RemoteRegistry<'cfg> {
/// Creates intermediate dirs and initialize the repository.
fn repo(&self) -> CargoResult<&git2::Repository> {
self.repo.try_borrow_with(|| {
trace!("acquiring registry index lock");
let path = self.config.assert_package_cache_locked(&self.index_path);

if let Ok(repo) = git2::Repository::open(&path) {
trace!("opened a repo without a lock");
return Ok(repo);
}

trace!("acquiring registry index lock");
match git2::Repository::open(&path) {
Ok(repo) => Ok(repo),
Err(_) => {
Expand Down Expand Up @@ -210,8 +205,6 @@ impl<'cfg> RemoteRegistry<'cfg> {
}
}

const LAST_UPDATED_FILE: &str = ".last-updated";

impl<'cfg> RegistryData for RemoteRegistry<'cfg> {
fn prepare(&self) -> CargoResult<()> {
self.repo()?;
Expand Down Expand Up @@ -357,7 +350,7 @@ impl<'cfg> RegistryData for RemoteRegistry<'cfg> {
self.head.set(None);
*self.tree.borrow_mut() = None;
self.current_sha.set(None);
let path = self.config.assert_package_cache_locked(&self.index_path);
let _path = self.config.assert_package_cache_locked(&self.index_path);
if !self.quiet {
self.config
.shell()
Expand All @@ -377,10 +370,6 @@ impl<'cfg> RegistryData for RemoteRegistry<'cfg> {
)
.with_context(|| format!("failed to fetch `{}`", url))?;

// Create a dummy file to record the mtime for when we updated the
// index.
paths::create(&path.join(LAST_UPDATED_FILE))?;

Ok(())
}

Expand Down

0 comments on commit 768708f

Please sign in to comment.