Skip to content

Conversation

rwe
Copy link
Contributor

@rwe rwe commented Feb 2, 2023

The flags --color-lines and --color-by-age are not mutually exclusive, and both affect the output format of git blame. This adds a test verifying git blame's output when run with both, where previously they were only tested independently.

blame is then taught to accept multiple values from blame.coloring, so that both modes can be set by configuration. Previously, the config only permitted one (repeatedLines) or the other (highlightRecent), despite the command line accepting both flags independently. This is a backwards-compatible change that does not alter the interpretation of existing configuration.

The list-parsing logic was derived from that of parse_color_moved_ws in diff.c.

@rwe rwe changed the title blame: allow blame.coloring to enable both --color-lines and --color-by-age blame: allow blame.coloring to specify both --color-lines and --color-by-age Feb 2, 2023
This adds a test verifying `git blame`'s output when run with both
`--color-lines` and `--color-by-age`. Those flags are not mutually
exclusive and both affect the output format. They were previously only
tested independently.

Signed-off-by: Robert Estelle <robertestelle@gmail.com>
@rwe rwe force-pushed the blame-color-config branch from 4c6f5e5 to 8c0c679 Compare February 2, 2023 04:26
rwe added 2 commits February 1, 2023 20:37
These flags correspond to specific values of the `blame.coloring` config
option. This adds a small note mentioning this correspondence.

Signed-off-by: Robert Estelle <robertestelle@gmail.com>
`blame.coloring` is now parsed as a comma-separated list, so that both
colorizers ("by age" and "by repeated lines") can be enabled via
configuration. Previously, they could be specified together on the
command line via --color-by-age and --color-lines, but not by config.

Signed-off-by: Robert Estelle <robertestelle@gmail.com>
@rwe rwe force-pushed the blame-color-config branch from 8c0c679 to e33ae07 Compare February 2, 2023 04:47
@rwe rwe marked this pull request as ready for review February 2, 2023 19:13
@rwe
Copy link
Contributor Author

rwe commented Feb 2, 2023

/submit

@gitgitgadget-git
Copy link

Submitted as pull.1449.git.git.1675365406.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-git-1449/rwe/blame-color-config-v1

To fetch this version to local tag pr-git-1449/rwe/blame-color-config-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-git-1449/rwe/blame-color-config-v1

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

Successfully merging this pull request may close these issues.

1 participant