Fossil SCM
Explained why we don't leave diff-command unset for the "bat" alternative.
Commit
9fca91e8e3d225f7cf80b3b0226e7e3bc98df2b0918aa196b491a83e611d6da1
Parent
7c99ebc5921446c…
1 file changed
+7
-1
+7
-1
| --- www/colordiff.md | ||
| +++ www/colordiff.md | ||
| @@ -68,15 +68,21 @@ | ||
| 68 | 68 | We can work around the `--color=auto` problem by switching from GNU less |
| 69 | 69 | as our pager to [`bat`][bat], as it can detect GNU diff output and |
| 70 | 70 | colorize it for you: |
| 71 | 71 | |
| 72 | 72 | fossil set --global diff-command 'diff -dwu --color=auto' |
| 73 | - fossil diff -i | bat | |
| 73 | + fossil diff | bat | |
| 74 | 74 | |
| 75 | 75 | In this author’s experience, that works a lot more reliably than GNU |
| 76 | 76 | less’s ANSI color escape code handling, even when you set `LESS=-R` in |
| 77 | 77 | your environment. |
| 78 | + | |
| 79 | +The reason we don’t leave the `diff-command` unset in this case is that | |
| 80 | +Fossil produces additional lines at the start which confuse the diff | |
| 81 | +format detection in `bat`. Forcing output through an external diff | |
| 82 | +command solves that. It also means that if you forget to pipe the output | |
| 83 | +through `bat`, you still get colorized output from GNU diff. | |
| 78 | 84 | |
| 79 | 85 | [bat]: https://github.com/sharkdp/bat |
| 80 | 86 | |
| 81 | 87 | |
| 82 | 88 | <a id="colordiff"></a> |
| 83 | 89 |
| --- www/colordiff.md | |
| +++ www/colordiff.md | |
| @@ -68,15 +68,21 @@ | |
| 68 | We can work around the `--color=auto` problem by switching from GNU less |
| 69 | as our pager to [`bat`][bat], as it can detect GNU diff output and |
| 70 | colorize it for you: |
| 71 | |
| 72 | fossil set --global diff-command 'diff -dwu --color=auto' |
| 73 | fossil diff -i | bat |
| 74 | |
| 75 | In this author’s experience, that works a lot more reliably than GNU |
| 76 | less’s ANSI color escape code handling, even when you set `LESS=-R` in |
| 77 | your environment. |
| 78 | |
| 79 | [bat]: https://github.com/sharkdp/bat |
| 80 | |
| 81 | |
| 82 | <a id="colordiff"></a> |
| 83 |
| --- www/colordiff.md | |
| +++ www/colordiff.md | |
| @@ -68,15 +68,21 @@ | |
| 68 | We can work around the `--color=auto` problem by switching from GNU less |
| 69 | as our pager to [`bat`][bat], as it can detect GNU diff output and |
| 70 | colorize it for you: |
| 71 | |
| 72 | fossil set --global diff-command 'diff -dwu --color=auto' |
| 73 | fossil diff | bat |
| 74 | |
| 75 | In this author’s experience, that works a lot more reliably than GNU |
| 76 | less’s ANSI color escape code handling, even when you set `LESS=-R` in |
| 77 | your environment. |
| 78 | |
| 79 | The reason we don’t leave the `diff-command` unset in this case is that |
| 80 | Fossil produces additional lines at the start which confuse the diff |
| 81 | format detection in `bat`. Forcing output through an external diff |
| 82 | command solves that. It also means that if you forget to pipe the output |
| 83 | through `bat`, you still get colorized output from GNU diff. |
| 84 | |
| 85 | [bat]: https://github.com/sharkdp/bat |
| 86 | |
| 87 | |
| 88 | <a id="colordiff"></a> |
| 89 |