Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ redb = "2"
reflink = "0.1"
serde = { version = "1", features = ["derive"] }
thiserror = "1"
serde_json = "1.0.149"
[target.'cfg(not(windows))'.dependencies]
nix = { version = "0.27", features = ["ioctl"] }
xattr = "1"
Expand All @@ -40,4 +41,5 @@ xattr = "1"
assert_cmd = "2"
tempfile = "3"
predicates = "3"
walkdir = "2"
walkdir = "2"
serde_json = "1"
30 changes: 16 additions & 14 deletions src/dedupe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ pub fn replace_with_link(
let target_permissions = target_meta.permissions();
let target_mtime = FileTime::from_last_modification_time(&target_meta);

let mut _target_xattrs: Vec<(OsString, Vec<u8>)> = Vec::new();
#[cfg(not(windows))]
let mut target_xattrs: Vec<(OsString, Vec<u8>)> = Vec::new();
#[cfg(not(windows))]
if let Ok(attrs) = xattr::list(target) {
for attr_name in attrs {
if let Ok(Some(attr_value)) = xattr::get(target, &attr_name) {
target_xattrs.push((attr_name, attr_value));
{
if let Ok(attrs) = xattr::list(target) {
for attr_name in attrs {
if let Ok(Some(attr_value)) = xattr::get(target, &attr_name) {
_target_xattrs.push((attr_name, attr_value));
}
}
}
}
Expand All @@ -75,7 +76,7 @@ pub fn replace_with_link(
cleanup.disarm();

#[cfg(not(windows))]
apply_metadata(target, &target_permissions, target_mtime, &target_xattrs)?;
apply_metadata(target, &target_permissions, target_mtime, &_target_xattrs)?;
#[cfg(windows)]
apply_metadata(target, &target_permissions, target_mtime)?;

Expand Down Expand Up @@ -153,13 +154,14 @@ pub fn restore_file(target: &Path) -> Result<()> {
let target_permissions = target_meta.permissions();
let target_mtime = FileTime::from_last_modification_time(&target_meta);

let mut _target_xattrs: Vec<(OsString, Vec<u8>)> = Vec::new();
#[cfg(not(windows))]
let mut target_xattrs: Vec<(OsString, Vec<u8>)> = Vec::new();
#[cfg(not(windows))]
if let Ok(attrs) = xattr::list(target) {
for attr_name in attrs {
if let Ok(Some(attr_value)) = xattr::get(target, &attr_name) {
target_xattrs.push((attr_name, attr_value));
{
if let Ok(attrs) = xattr::list(target) {
for attr_name in attrs {
if let Ok(Some(attr_value)) = xattr::get(target, &attr_name) {
_target_xattrs.push((attr_name, attr_value));
}
}
}
}
Expand All @@ -182,7 +184,7 @@ pub fn restore_file(target: &Path) -> Result<()> {
cleanup.disarm();

#[cfg(not(windows))]
apply_metadata(target, &target_permissions, target_mtime, &target_xattrs)?;
apply_metadata(target, &target_permissions, target_mtime, &_target_xattrs)?;
#[cfg(windows)]
apply_metadata(target, &target_permissions, target_mtime)?;

Expand Down
Loading
Loading