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

file a/b in diffs should only be coloured red/green on renames #375

Open
calestyo opened this issue Feb 18, 2015 · 3 comments
Open

file a/b in diffs should only be coloured red/green on renames #375

calestyo opened this issue Feb 18, 2015 · 3 comments
Labels

Comments

@calestyo
Copy link

Hi.

In the diff views the lines for filea/b, e.g.:
--- a/foo
+++ b/foo
are coloured red/green.

I think it would be better for readability if this was only the case if the file was also renamed, e.g.
--- a/foo
+++ b/bar

Cheers,
Chris.

jonas added a commit that referenced this issue Feb 18, 2015
The lines containing the file name are now colored using the same color
as the diff header and index lines:

  diff --git a/NEWS.adoc b/NEWS.adoc
  index 6b152f3..bf0c83a 100644
  --- a/NEWS.adoc
  +++ b/NEWS.adoc

References #375
@jonas
Copy link
Owner

jonas commented Feb 18, 2015

I've fixed it so that all diff header lines have the same (yellow) color.
Changing the color based on whether the file is renamed is a lot harder and I am not sure it is really that useful since Git will add its own rename meta lines.

What do you think?

@calestyo
Copy link
Author

Hey...
Well,... not fully sure.

It seems that in tig, when you look into a commit with renames, the old file is listed with all lines removed (i.e. starting with - in the diff) and the new files with everything added.
The same is the case for the short stat given before the diff.

And the file name is e.g.
--- a/oldname
+++ /dev/null
respectively:
--- /dev/null
+++ b/newname

gitg does that better.
it only lists lines like;
diff --git a/old1 b/new1
similarity index 100%
rename from old2
rename to new2
(if there is no difference).

And if the file wasn't just renamed, but also has modifications (but is still detected as renamed), than it does what I've described originally, i.e.
--- a/foo
+++ b/bar
(and afterwards the diffs between the old and new file, but just the real differences,.. not everything - and then everything +)

Cheers,
Chris

@jonas
Copy link
Owner

jonas commented Aug 7, 2016

Tig doesn't automatically enable rename detection, like gtig. It used to but it was removed to make diff loading faster. Maybe something to reconsider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants