Skip to content

🐛 weird? handling of git colorMoved #1098

@martinetd

Description

@martinetd

Hello,

thanks for delta!
(running on master's top, e7dbdd4)

I just noticed weird coloration on a commit.
After investigating it is due to git's diff.colorMoved = default, left without it and right with it:

delta

I glanced through #72 but there are no open issues about colorMoved so preferred to open a new one; now I've read about it quite a bit I can say it's not a bug: manual/src/color-moved-support.md clearly states delta passes git colors unchanged.
Remarks after output.

I'm sure there are plenty of example, but I noticed it on linux's a6809941c1f17f455db2cf4ca19c6d8c8746ec25 ; here's part of the output (to use with sed -e 's/\\33/\x1b/g' or something similar):

\33[1mdiff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c\33[m
\33[1mindex 6619e3caffe2..7a285fb0f619 100644\33[m
\33[1m--- a/drivers/pci/controller/dwc/pci-imx6.c\33[m
\33[1m+++ b/drivers/pci/controller/dwc/pci-imx6.c\33[m
\33[36m@@ -408,6 +408,11 @@\33[m \33[mstatic void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie)\33[m
 			dev_err(dev, \"failed to disable vpcie regulator: %d\
\",\33[m
 				ret);\33[m
 	}\33[m
\33[32m+\33[m
\33[1;36m+\33[m	\33[1;36m/* Some boards don't have PCIe reset GPIO. */\33[m
\33[32m+\33[m	\33[32mif (gpio_is_valid(imx6_pcie->reset_gpio))\33[m
\33[1;36m+\33[m		\33[1;36mgpio_set_value_cansleep(imx6_pcie->reset_gpio,\33[m
\33[1;36m+\33[m					\33[1;36mimx6_pcie->gpio_active_high);\33[m
 }\33[m
 \33[m
 static unsigned int imx6_pcie_grp_offset(const struct imx6_pcie *imx6_pcie)\33[m
\33[36m@@ -540,15 +545,6 @@\33[m \33[mstatic void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie)\33[m
 	/* allow the clocks to stabilize */\33[m
 	usleep_range(200, 500);\33[m
 \33[m
\33[1;35m-	/* Some boards don't have PCIe reset GPIO. */\33[m
\33[1;35m-	if (gpio_is_valid(imx6_pcie->reset_gpio)) {\33[m
\33[1;34m-		gpio_set_value_cansleep(imx6_pcie->reset_gpio,\33[m
\33[1;34m-					imx6_pcie->gpio_active_high);\33[m
\33[1;35m-		msleep(100);\33[m
\33[1;35m-		gpio_set_value_cansleep(imx6_pcie->reset_gpio,\33[m
\33[1;35m-					!imx6_pcie->gpio_active_high);\33[m
\33[31m-	}\33[m
\33[31m-\33[m
 	switch (imx6_pcie->drvdata->variant) {\33[m
 	case IMX8MQ:\33[m
 		reset_control_deassert(imx6_pcie->pciephy_reset);\33[m
\33[36m@@ -595,6 +591,15 @@\33[m \33[mstatic void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie)\33[m
 		break;\33[m
 	}\33[m
 \33[m
\33[1;36m+\33[m	\33[1;36m/* Some boards don't have PCIe reset GPIO. */\33[m
\33[1;36m+\33[m	\33[1;36mif (gpio_is_valid(imx6_pcie->reset_gpio)) {\33[m
\33[1;33m+\33[m		\33[1;33mmsleep(100);\33[m
\33[1;33m+\33[m		\33[1;33mgpio_set_value_cansleep(imx6_pcie->r

So:

  • first, I didn't remember I had colorMoved set in the first place... I just blindly copied it from the readme without understanding what it was doing, so it took me a while to understand what was up..
  • (quite unrelated but it also took me some time to get the raw text -- the issue template lists git --no-pager but that doesn't preserve colors when piping or sending to a file so it's useless. You also need --color=always. I didn't realize that was an option so I ended up getting my output from strace....)
  • Now I understand the option I can sort of read the diff? but it looks quite a bit out of place, although that might partly be due to my theme.

I'm not quite sure what to suggest here; now I understand this better I might try fiddling with themes a bit as described in #72 but that feels like quite an advanced featureand probably just shouldn't be promoted in the README without making manual/src/color-moved-support.md prominent, or making it more integrated with themes, or at least the default ones?

I realize it's not possible to make everyone happy and ultimately don't really care, just wanted to say this was 1/ surprising and 2/ made me waste quite a bit of time so I'm wasting more by venting :P

Thanks anyway :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions