Gabriella439 / nix-diff

Explain why two Nix derivations differ
BSD 3-Clause "New" or "Revised" License
357 stars 19 forks source link

Unified diff #21

Closed nh2 closed 5 years ago

nh2 commented 5 years ago

When you use --color never (or pipe into less) and it's trying to do diffs of strings:

                • The input named `zlib-1.2.11` differs
                  - /nix/store/7azkvrz4q57rx761bpfyhdpyv194zd5c-zlib-1.2.11.drv:{dev}
                  + /nix/store/m12qqq0j6x0grmxwp6my9k61hhxlza4h-zlib-1.2.11.drv:{dev}
                  • The environments do not match:
                      + dontDisableStatic=
                      configureFlags=--s→tatic --s→hared

Notice the s→tatic --s→hared.

I think it would make sense to have a mode that outputs the difference in a non-inline-diff way, e.g. as a unified diff even for just strings.

Ideally that would work with and without colour.

Gabriella439 commented 5 years ago

@nh2: By "unified" diff, do you mean a line-based diff?

nh2 commented 5 years ago

I mean the same output ass diff -u generates; that is usually line-based, yes. For me the line-based-ness is more important than the actual unified format (though that may be useful to view nix-diff output in diff viewers, not sure).

Gabriella439 commented 5 years ago

@nh2: Fix is up here: https://github.com/Gabriel439/nix-diff/pull/22

Let me know if that satisfies your use case