Skip to content

Commit

Permalink
Avoid overwriting the lockfile if there are no changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gkoz committed Oct 30, 2015
1 parent 96c5b8f commit 5f3f796
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/cargo/ops/lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ pub fn write_lockfile(dst: &Path, resolve: &Resolve) -> CargoResult<()> {
None => {}
}

// Load the original lockfile if it exists.
if let Ok(orig) = paths::read(dst) {
if out == orig {
// The lockfile contents haven't changed so don't rewrite it.
// This is helpful on read-only filesystems.
return Ok(())
}
}

try!(paths::write(dst, out.as_bytes()));
Ok(())
}
Expand Down

0 comments on commit 5f3f796

Please sign in to comment.