Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support diff -u ... | delta #53

Closed
fdcds opened this issue Nov 12, 2019 · 7 comments
Closed

Support diff -u ... | delta #53

fdcds opened this issue Nov 12, 2019 · 7 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@fdcds
Copy link

fdcds commented Nov 12, 2019

It would be nice if diff -u ... | delta was supported. Currently delta does not appear to parse the header correctly and instead passes on some garbage:

❯ diff -u a b | delta
diff -u a/file b/file
--- a/file      2019-11-12 19:33:40.199834121 +0100

file    2019-11-12
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
+++ b/file      2019-11-12 19:33:54.767769647 +0100

1
 a                                                                                                                                                                                                                                                                                                                                                                                                                                       
 b                                                                                                                                                                                                                                                                                                                                                                                                                                       
 c                                                                                                                                                                                                                                                                                                                                                                                                                                       
 x                                                                                                                                                                                                                                                                                                                                                                                                                                       
   a                                                                                                                                                                                                                                                                                                                                                                                                                                     
   b                                                                                                                                                                                                                                                                                                                                                                                                                                     
   c                                                                                                                                                                                                                                                                                                                                                                                                                                     
 y                                                                                                                                                                                                                                                                                                                                                                                                                                       
 iff -u a/file2 b/file2                                                                                                                                                                                                                                                                                                                                                                                                                  
--- a/file2     2019-11-12 19:40:49.344885714 +0100

file2   2019-11-12
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
+++ b/file2     2019-11-12 19:40:54.800860547 +0100

1 
 1                                                                                                                                                                                                                                                                                                                                                                                                                                       
 2   

Note how the diff command for file2 even lost its first character. (It actually displays like that and is not a copy & paste mistake by me.)

Using delta version 0.0.14.

@dandavison
Copy link
Owner

Thanks, absolutely agree this makes sense. (Indeed it makes me uncomfortable that the package name is git-delta seeing as I would like it to support standard unified diff when not embedded in git output.)

Incidentally, this would make a good issue for anyone looking for a smallish Rust exercise.

@dandavison dandavison added the good first issue Good for newcomers label Nov 12, 2019
@m-lima
Copy link
Contributor

m-lima commented Nov 15, 2019

I'm pretty new to Rust and I would like to start contributing to OSS. Do you mind if I take a stab at this?

@dandavison
Copy link
Owner

@m-lima That would be great, thanks very much! Feel free to discuss further / ask me any questions.

@m-lima
Copy link
Contributor

m-lima commented Nov 17, 2019

Thanks @dandavison, I will get started on it

@fdcds I wasn't able to really replicate the problem on version 0.0.14
I tried it on Ubuntu and Catalina.
However, I did notice an assumption of a/<file_name_1> and b/<file_name_2> from git --diff. But that the most of a weird behavior I got

@m-lima
Copy link
Contributor

m-lima commented Nov 18, 2019

I understood the situation now. It is more accentuated when comparing directories, and you have multiple file headers.
Pushing a commit to assess that as well, by adding a new state that captures diff -u or diff -U

@dandavison
Copy link
Owner

This is fixed in master, including handling of unified diff directory comparisons, thanks to work by @m-lima: #56.

@fdcds
Copy link
Author

fdcds commented Nov 26, 2019

Thanks a lot to both of you!

@dandavison dandavison added the enhancement New feature or request label Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants