gitui icon indicating copy to clipboard operation
gitui copied to clipboard

view like `git diff --color-moved`

Open skyfaller opened this issue 3 years ago • 15 comments

Sometimes code has simply been moved around, rather than deleted or added. It would be nice to be able to see this at a glance. The command git diff --color-moved will display this, or you can set --color-moved to be git's default with a command like git config --global diff.colorMoved default.

Sadly I do not see an option to achieve this behavior in gitui.

Describe the solution you'd like I would like an option to make code that has been moved visually distinct from code that has been added or deleted. I think this should be visible when viewing diffs in the Status [1] tab.

Personally I think this should be enabled by default, but I'm certain some number of people will disagree with me.

Describe alternatives you've considered The alternatives are manually looking to see whether code has merely moved, or to drop back to the git command line.

Additional context delta successfully supports this feature: https://github.com/dandavison/delta/issues/72

Here's a blog post that alerted me to the existence of this feature: https://danyspin97.org/blog/modern-cli-applications-part-1/#bonus-color-moved

skyfaller avatar Aug 21 '21 02:08 skyfaller

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 19 '21 21:11 stale[bot]

Please remove stale bot, it contributes nothing to the conversation: https://github.com/extrawurst/gitui/issues/996

This still seems like a desirable feature that shouldn't be too hard to add.

skyfaller avatar Nov 19 '21 21:11 skyfaller

@skyfaller I appreciate you bringing up this feature request but it did not convince any contributor willing to invest their free time to work on it. the stale bot is not deleting or preventing active conversations. this ticket stays around forever and for future reference.

Still if the bot would not be around I would manually close issues that qualify as:

  • not actively discussed
  • not actively worked on
  • not part of the roadmap
  • not committed to being implemented by a contributor

this reduces the cognitive load of managing this project for me, nothing personal against you

extrawurst avatar Nov 20 '21 00:11 extrawurst

Can you say anything about what it would require to implement this feature, perhaps as guidance for someone looking to get involved with gitui development and finds this issue interesting? For example, where the code is that emits the diffs in the status tab?

Do you have any opinions on the three possible approaches that delta considered? Delta had to make some tradeoffs between syntax highlighting, Git's color-moved option nuances, and complexity/fragility, ultimately choosing to sacrifice syntax highlighting on moved lines for now. Are all of these options open to gitui? Would you want to make the same tradeoffs?

skyfaller avatar Nov 22 '21 18:11 skyfaller

This issue has been automatically marked as stale because it has not had any activity half a year. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 31 '22 02:05 stale[bot]

Another related feature that would be cool is git diff --color-moved-ws which controls how whitespace is or isn’t ignored when colorizing diffs. You can think of it like the other space-ignoring options (like --ignore-space-at-eol, --ignore-space-change, or --ignore-all-space), but specifically for when you’re running diff in the --color-moved mode.

Here's an example of how that is useful, when looking at code where the indentation changed but not much else: https://twitter.com/jb55/status/1129758919973396483

skyfaller avatar May 31 '22 14:05 skyfaller

This issue has been automatically marked as stale because it has not had any activity half a year. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 21 '22 01:12 stale[bot]

I'll think of something productive to say next time stale bot rolls around. Right now I'm visiting my family for the solstice.

Happy holidays and a joyful new year to everyone, especially people working on gitui!

skyfaller avatar Dec 21 '22 03:12 skyfaller

Wait, is stale bot not counting my last comment? Why is this still marked as dormant? Has stale bot become sentient enough to recognize that my last comment only contained holiday greetings?

skyfaller avatar Dec 24 '22 15:12 skyfaller

This issue has been automatically marked as stale because it has not had any activity half a year. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 12 '23 13:08 stale[bot]

How are you doing? My phone randomly died, but I'm finally back online with a new one. It's a beautiful summer day, maybe I'll go for a bike ride tonight.

Keep up the good work, and please don't mark this issue as stale!

skyfaller avatar Aug 16 '23 21:08 skyfaller

I didn't make it out for a bike ride the other night, but here's an Eastern Tiger Swallowtail on a butterfly bush!

PXL_20230727_165104583~2.jpg

If stale bot likes butterfly pictures, I have more where that came from ;-)

But seriously, what is going on here? Did stale bot level up so that it takes two posts to defeat it now?

skyfaller avatar Aug 22 '23 12:08 skyfaller

This issue has been automatically marked as stale because it has not had any activity half a year. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 17 '24 15:03 stale[bot]

I have nothing to report about git diff --color-moved, but today I saw a house finch up close for the first time in person. It landed on a bird feeder about five feet from my head, and I was able to appreciate its red plumage in detail.

I'm really excited because goldfinches have nested in the trees across the street for the last couple of years, and the other day I heard and saw a goldfinch there again! Maybe we will soon welcome more tiny goldfinches to the neighborhood.

Those colors sure are moving :-)

skyfaller avatar Mar 31 '24 03:03 skyfaller

Aww man, are we still requiring the stale bot double-tap? Here's comment number two.

I had to bike home in the rain today and got really grumpy, but then I thought about this sign I saw in my neighborhood last week.

PXL_20240329_202641841.jpg

What do you get when you get more rain? More rainbows.

skyfaller avatar Mar 31 '24 03:03 skyfaller