-
Notifications
You must be signed in to change notification settings - Fork 393
Open
Description
I have some changes in Rust source code that are incorrectly (or at least confusingly) represented in difftastic's inline view. It's omitting some unchanged context lines which tends to make them look as if they're being deleted.

It looks like the backup
struct member is being replaced, but it's not. A regular GNU diff makes this clearer:
--- conserve-before.rs 2025-07-05 10:26:23.983726899 -0700
+++ conserve-after.rs 2025-07-05 10:26:12.390702623 -0700
@@ -105,15 +105,28 @@
Delete {
/// Archive to delete from.
archive: String,
+
/// Backup to delete, as an id like 'b1'. May be repeated with commas.
- #[arg(long, short, value_delimiter = ',', required(true))]
+ #[arg(
+ long,
+ short,
+ value_delimiter = ',',
+ required_unless_present = "expiry_days"
+ )]
backup: Vec<BandId>,
+
+ /// Delete backups that are older than the specified number of days.
+ #[arg(long, required_unless_present = "backup")]
+ expiry_days: Option<u32>,
+
Here's the difft output as text:
; difft --display=inline conserve-before.rs conserve-after.rs
conserve-after.rs --- 1/4 --- Rust
105 Delete {
106 /// Archive to delete from.
107 archive: String,
108 /// Backup to delete, as an id like 'b1'. May be repeated with commas.
109 #[arg(long, short, value_delimiter = ',', required(true))]
110 #[arg(
114 required_unless_present = "expiry_days"
118 /// Delete backups that are older than the specified number of days.
119 #[arg(long, required_unless_present = "backup")]
120 expiry_days: Option<u32>,
121
122 /// Don't actually delete, just check what could be deleted.
123 #[arg(long)]
124 dry_run: bool,
The side-by-side view makes it clear the backup
field isn't actually deleted:

; difft conserve-before.rs conserve-after.rs
conserve-after.rs --- 1/4 --- Rust
107 archive: String, 107 archive: String,
... 108
108 /// Backup to delete, as an id like 'b1'. May be repeated with 109 /// Backup to delete, as an id like 'b1'. May be repeated with
... commas. ... commas.
109 #[arg(long, short, value_delimiter = ',', required(true))] 110 #[arg(
... 111 long,
... 112 short,
... 113 value_delimiter = ',',
... 114 required_unless_present = "expiry_days"
... 115 )]
110 backup: Vec<BandId>, 116 backup: Vec<BandId>,
... 117
... 118 /// Delete backups that are older than the specified number of
... ... days.
... 119 #[arg(long, required_unless_present = "backup")]
... 120 expiry_days: Option<u32>,
... 121
111 /// Don't actually delete, just check what could be deleted. 122 /// Don't actually delete, just check what could be deleted.
112 #[arg(long)] 123 #[arg(long)]
Here are the files (with .txt
added to allow them to be attached.)
conserve-before.rs.txt
conserve-after.rs.txt
; difft --version
Difftastic 0.64.0
Revision: 484708c 2025-06-15
Toolchain: 1.74.1
System: linux x86_64
Metadata
Metadata
Assignees
Labels
No labels