Am 03.07.24 um 17:24 schrieb Emanuel Czirai: > With the aforementioned `diffy` patch, the generated diff would actually be > with a context of 4, to make it unambiguous, so it would've been this: > ```diff > --- original > +++ modified > @@ -1186,8 +1186,12 @@ > self.gctx.shell().warn(msg)? > } > } > } > + if seen_any_warnings { > + //use anyhow::bail; > + bail!("reasons"); > + } > Ok(()) > } > > pub fn emit_lints(&self, pkg: &Package, path: &Path) -> > CargoResult<()> { > ``` > this hunk is now unambiguous because it cannot be applied in more than 1 > place in the original file, This assertion is wrong, assuming that the patch is to be applied to a modified version of 'original'. There is nothing that can be done at the time when a patch is generated to make it unambiguous, not even if the entire file becomes context. The reason is that the modified 'original' could now have the part duplicated that is the context in the patch, and it would be possible to apply the patch any one of the duplicates. Which one? -- Hannes