From 87cfabbebd728dcb552c188a6a85f15a12667b1b Mon Sep 17 00:00:00 2001 From: Joe Block Date: Mon, 4 Mar 2024 09:10:54 -0700 Subject: [PATCH 01/24] Add awesomebot link checker (#486) Add a github action to check the links in README.md Signed-off-by: Joe Block --- .github/workflows/awesomebot.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/awesomebot.yml diff --git a/.github/workflows/awesomebot.yml b/.github/workflows/awesomebot.yml new file mode 100644 index 0000000..f94abc4 --- /dev/null +++ b/.github/workflows/awesomebot.yml @@ -0,0 +1,23 @@ +--- +name: Check links in README + +on: + push: + branches: [ '*' ] + pull_request: + branches: [ '*' ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + # Full git history is needed to get a proper list of changed files + # within `mega-linter` + fetch-depth: 0 + - uses: docker://dkhamsing/awesome_bot:latest + with: + args: /github/workspace/README.md --allow-ssl --allow 202,500,501,502,503,504,509,521 --allow-dupe --allow-redirect --request-delay 1 From b58488a00eb9c8294cfedfa5991241801d862c8d Mon Sep 17 00:00:00 2001 From: Joe Block Date: Tue, 5 Mar 2024 08:24:26 -0700 Subject: [PATCH 02/24] Fix broken link in README.md (#484) * Fix broken link in README.md Closes #483 Signed-off-by: Joe Block * Updated link per feedback Signed-off-by: Joe Block * Update link per feedback Remove the `http://...` portion of the link Signed-off-by: Joe Block --------- Signed-off-by: Joe Block --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 30ae547..3b6ec18 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Vanilla `git diff` vs `git` and `diff-so-fancy` Installation is as simple as cloning this repo and then putting the `diff-so-fancy` script in to your `$PATH`. The `lib/` directory will need to be kept relative to the core script. -If you are using a ZSH framework like [zgenom](https://github.com/jandamm/zgenom) or [oh-my-zsh](https://ohmyz.sh), refer to [ZSH framework install](zsh-frameworks.md) for detailed installation instructions. +If you are using a ZSH framework like [zgenom](https://github.com/jandamm/zgenom) or [oh-my-zsh](https://ohmyz.sh), refer to [Zsh plugin suppport for diff-so-fancy](/blob/next/pro-tips.md) for detailed installation instructions. `diff-so-fancy` is also available from the [NPM registry](https://www.npmjs.com/package/diff-so-fancy), [brew](https://formulae.brew.sh/formula/diff-so-fancy), as a package on [Nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/version-management/diff-so-fancy/default.nix), [Fedora](https://packages.fedoraproject.org/pkgs/diff-so-fancy/diff-so-fancy/), in the [Arch extra repo](https://archlinux.org/packages/extra/any/diff-so-fancy/), and as [ppa:aos for Debian/Ubuntu Linux](https://github.com/aos/dsf-debian). From 9aa97d9c9d7d6b9680ba0dc713475e19dfdf7e89 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Tue, 5 Mar 2024 07:26:28 -0800 Subject: [PATCH 03/24] Fixing a link I incorrectly advised on. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3b6ec18..6ccda80 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Vanilla `git diff` vs `git` and `diff-so-fancy` Installation is as simple as cloning this repo and then putting the `diff-so-fancy` script in to your `$PATH`. The `lib/` directory will need to be kept relative to the core script. -If you are using a ZSH framework like [zgenom](https://github.com/jandamm/zgenom) or [oh-my-zsh](https://ohmyz.sh), refer to [Zsh plugin suppport for diff-so-fancy](/blob/next/pro-tips.md) for detailed installation instructions. +If you are using a ZSH framework like [zgenom](https://github.com/jandamm/zgenom) or [oh-my-zsh](https://ohmyz.sh), refer to [Zsh plugin suppport for diff-so-fancy](pro-tips.md) for detailed installation instructions. `diff-so-fancy` is also available from the [NPM registry](https://www.npmjs.com/package/diff-so-fancy), [brew](https://formulae.brew.sh/formula/diff-so-fancy), as a package on [Nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/version-management/diff-so-fancy/default.nix), [Fedora](https://packages.fedoraproject.org/pkgs/diff-so-fancy/diff-so-fancy/), in the [Arch extra repo](https://archlinux.org/packages/extra/any/diff-so-fancy/), and as [ppa:aos for Debian/Ubuntu Linux](https://github.com/aos/dsf-debian). From 36aaf3041aebc253697d6db8126124521fb16f5d Mon Sep 17 00:00:00 2001 From: vitalmotif <164124773+vitalmotif@users.noreply.github.com> Date: Wed, 20 Mar 2024 22:22:43 +0800 Subject: [PATCH 04/24] chore: fix some typos (#487) Signed-off-by: vitalmotif --- hacking-and-testing.md | 2 +- update-deps.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hacking-and-testing.md b/hacking-and-testing.md index 10f8936..2620d17 100644 --- a/hacking-and-testing.md +++ b/hacking-and-testing.md @@ -17,7 +17,7 @@ cd ~/projects/catfabulator && git diff The tests use [bats-core](https://bats-core.readthedocs.io/en/latest/index.html), the Bash automated testing system. ```sh -# initalize the bats components +# initialize the bats components git submodule sync && git submodule update --init # run the test suite once: diff --git a/update-deps.sh b/update-deps.sh index cec889e..8156a81 100755 --- a/update-deps.sh +++ b/update-deps.sh @@ -1,4 +1,4 @@ #!/bin/bash -# initalize the bats components +# initialize the bats components git submodule sync && git submodule update --init From 7f619bd018f4a4089bdca70bf0ad61799d4189a9 Mon Sep 17 00:00:00 2001 From: Thomas Wu <62056970+TakumiBC@users.noreply.github.com> Date: Tue, 2 Apr 2024 08:58:21 +0800 Subject: [PATCH 05/24] fix: Incorrect incorrect title in pro-tips.md (#488) --- pro-tips.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pro-tips.md b/pro-tips.md index 8b7aaa7..41eb524 100644 --- a/pro-tips.md +++ b/pro-tips.md @@ -62,7 +62,7 @@ zinit load so-fancy/diff-so-fancy zplug "so-fancy/diff-so-fancy", as:command, use:bin/git-dsf ``` -# zgenom and others +### zgenom and others ```sh zgenom load so-fancy/diff-so-fancy From baf2698ee19fe140c774aa103c3c866b9fddd0c4 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Sat, 13 Apr 2024 20:21:16 -0700 Subject: [PATCH 06/24] Add some comments --- diff-so-fancy | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/diff-so-fancy b/diff-so-fancy index da5277a..af9e9d0 100755 --- a/diff-so-fancy +++ b/diff-so-fancy @@ -974,6 +974,7 @@ sub set_ansi_color { } } +# Is the string 100% numeric sub is_numeric { my $s = shift(); @@ -984,6 +985,7 @@ sub is_numeric { return 0; } +# Does the string start with ANSI sub starts_with_ansi { my $str = shift(); @@ -1054,6 +1056,7 @@ sub show_debug_info { print "Operating System: $^O\n"; } +# Boolean to yes/no string sub yes_no { my $val = shift(); @@ -1073,6 +1076,7 @@ sub init_diff_highlight_colors { $DiffHighlight::OLD_HIGHLIGHT[1] = git_ansi_color(git_config('color.diff-highlight.oldhighlight')) || $DiffHighlight::OLD_HIGHLIGHT[1]; } +# Write a line to the debug log which is opened on the fly as-needed sub debug_log { my $log_line = shift(); my $file = "/tmp/diff-so-fancy.debug.log"; @@ -1088,12 +1092,16 @@ sub debug_log { return 1; } +# Count the number of context lines in the diff sub calculate_context_lines { my @lines = @_; my $count = 0; my $hunk_line = 0; + # Count the number of lines between the hunk line and the + # first + or - line foreach my $line (@lines) { + # Look for the hunk line before we start if ($line =~ /^${ansi_color_regex}(@@@* .+? @@@*)(.*)/) { $hunk_line = $count; } elsif ($hunk_line && $line =~ /^${ansi_color_regex}[+-]/) { From 3876348358c3244553f30d5c2b3c8ed97186183d Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Sat, 13 Apr 2024 20:21:39 -0700 Subject: [PATCH 07/24] Use state for static variables --- diff-so-fancy | 58 +++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/diff-so-fancy b/diff-so-fancy index af9e9d0..348af12 100755 --- a/diff-so-fancy +++ b/diff-so-fancy @@ -849,41 +849,39 @@ sub color { } # Get colors used for various output sections (memoized) -{ - my $static_config; +sub get_config_color { + my $str = shift(); - sub get_config_color { - my $str = shift(); + state $static_config; - my $ret = ""; - if ($static_config->{$str}) { - return $static_config->{$str}; - } + my $ret = ""; + if ($static_config->{$str}) { + return $static_config->{$str}; + } - #print color(15) . "Shelling out for color: '$str'\n" . color('reset'); - - if ($str eq "meta") { - # Default ANSI yellow - $ret = git_ansi_color(git_config('color.diff.meta')) || color(11); - } elsif ($str eq "reset") { - $ret = color("reset"); - } elsif ($str eq "add_line") { - # Default ANSI green - $ret = git_ansi_color(git_config('color.diff.new')) || color("2_bold"); - } elsif ($str eq "remove_line") { - # Default ANSI red - $ret = git_ansi_color(git_config('color.diff.old')) || color("1_bold"); - } elsif ($str eq "fragment") { - $ret = git_ansi_color(git_config('color.diff.frag')) || color("13_bold"); - } elsif ($str eq "last_function") { - $ret = git_ansi_color(git_config('color.diff.func')) || color("146_bold"); - } + #print color(15) . "Shelling out for color: '$str'\n" . color('reset'); + + if ($str eq "meta") { + # Default ANSI yellow + $ret = git_ansi_color(git_config('color.diff.meta')) || color(11); + } elsif ($str eq "reset") { + $ret = color("reset"); + } elsif ($str eq "add_line") { + # Default ANSI green + $ret = git_ansi_color(git_config('color.diff.new')) || color("2_bold"); + } elsif ($str eq "remove_line") { + # Default ANSI red + $ret = git_ansi_color(git_config('color.diff.old')) || color("1_bold"); + } elsif ($str eq "fragment") { + $ret = git_ansi_color(git_config('color.diff.frag')) || color("13_bold"); + } elsif ($str eq "last_function") { + $ret = git_ansi_color(git_config('color.diff.func')) || color("146_bold"); + } - # Cache (memoize) the entry for later - $static_config->{$str} = $ret; + # Cache (memoize) the entry for later + $static_config->{$str} = $ret; - return $ret; - } + return $ret; } # https://www.git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_colors_in_git From 01efadf87034f4eb022b7f35783fbba87e97d207 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Sat, 13 Apr 2024 20:24:29 -0700 Subject: [PATCH 08/24] Add the new color() with a text option --- diff-so-fancy | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/diff-so-fancy b/diff-so-fancy index 348af12..879aadb 100755 --- a/diff-so-fancy +++ b/diff-so-fancy @@ -823,18 +823,21 @@ sub set_defaults { # Borrowed from: https://www.perturb.org/display/1167_Perl_ANSI_colors.html # String format: '115', '165_bold', '10_on_140', 'reset', 'on_173', 'red', 'white_on_blue' sub color { - my $str = shift(); + my ($str, $txt) = @_; + + # If we're NOT connected to a an interactive terminal don't do color + #if (-t STDOUT == 0) { return ''; } # No string sent in, so we just reset if (!length($str) || $str eq 'reset') { return "\e[0m"; } # Some predefined colors - my %color_map = qw(red 160 blue 21 green 34 yellow 226 orange 214 purple 93 white 15 black 0); + my %color_map = qw(red 160 blue 27 green 34 yellow 226 orange 214 purple 93 white 15 black 0); $str =~ s|([A-Za-z]+)|$color_map{$1} // $1|eg; # Get foreground/background and any commands - my ($fc,$cmd) = $str =~ /(\d+)?_?(\w+)?/g; - my ($bc) = $str =~ /on_?(\d+)/g; + my ($fc,$cmd) = $str =~ /^(\d{1,3})?_?(\w+)?$/g; + my ($bc) = $str =~ /on_(\d{1,3})$/g; # Some predefined commands my %cmd_map = qw(bold 1 italic 3 underline 4 blink 5 inverse 7); @@ -844,6 +847,7 @@ sub color { if ($cmd_num) { $ret .= "\e[${cmd_num}m"; } if (defined($fc)) { $ret .= "\e[38;5;${fc}m"; } if (defined($bc)) { $ret .= "\e[48;5;${bc}m"; } + if ($txt) { $ret .= $txt . "\e[0m"; } return $ret; } From 928cd88de62cccf777b2662f64db955ba748bbab Mon Sep 17 00:00:00 2001 From: Tobias Preuss Date: Mon, 15 Apr 2024 17:01:16 +0200 Subject: [PATCH 09/24] Fix minor typo. (#489) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ccda80..8787260 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Vanilla `git diff` vs `git` and `diff-so-fancy` Installation is as simple as cloning this repo and then putting the `diff-so-fancy` script in to your `$PATH`. The `lib/` directory will need to be kept relative to the core script. -If you are using a ZSH framework like [zgenom](https://github.com/jandamm/zgenom) or [oh-my-zsh](https://ohmyz.sh), refer to [Zsh plugin suppport for diff-so-fancy](pro-tips.md) for detailed installation instructions. +If you are using a ZSH framework like [zgenom](https://github.com/jandamm/zgenom) or [oh-my-zsh](https://ohmyz.sh), refer to [Zsh plugin support for diff-so-fancy](pro-tips.md) for detailed installation instructions. `diff-so-fancy` is also available from the [NPM registry](https://www.npmjs.com/package/diff-so-fancy), [brew](https://formulae.brew.sh/formula/diff-so-fancy), as a package on [Nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/version-management/diff-so-fancy/default.nix), [Fedora](https://packages.fedoraproject.org/pkgs/diff-so-fancy/diff-so-fancy/), in the [Arch extra repo](https://archlinux.org/packages/extra/any/diff-so-fancy/), and as [ppa:aos for Debian/Ubuntu Linux](https://github.com/aos/dsf-debian). From 4ad3efc4f144994204353b5ddf5ff958da770a53 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Mon, 15 Apr 2024 08:33:08 -0700 Subject: [PATCH 10/24] Make Delta into a link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8787260..192d49c 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,7 @@ Pull requests are quite welcome, and should target the [`next` branch](https://g ## Alternatives -* https://github.com/dandavison/delta +* [Delta](https://github.com/dandavison/delta) ## License From 89b656b94608034b5605056c5da10e03464d7a95 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Mon, 15 Apr 2024 08:33:30 -0700 Subject: [PATCH 11/24] Add a link to Lazygit with diff-so-fancy integration --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 192d49c..af411ab 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,7 @@ Pull requests are quite welcome, and should target the [`next` branch](https://g ## Alternatives * [Delta](https://github.com/dandavison/delta) +* [Lazygit](https://github.com/jesseduffield/lazygit) with diff-so-fancy [integration](https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md#diff-so-fancy) ## License From e6b07ba98f0584f738204794fa6834e5094620b6 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Mon, 15 Apr 2024 08:47:20 -0700 Subject: [PATCH 12/24] Use correct quotes for humans --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index af411ab..0bc89d0 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ If you are using a ZSH framework like [zgenom](https://github.com/jandamm/zgenom `diff-so-fancy` is also available from the [NPM registry](https://www.npmjs.com/package/diff-so-fancy), [brew](https://formulae.brew.sh/formula/diff-so-fancy), as a package on [Nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/version-management/diff-so-fancy/default.nix), [Fedora](https://packages.fedoraproject.org/pkgs/diff-so-fancy/diff-so-fancy/), in the [Arch extra repo](https://archlinux.org/packages/extra/any/diff-so-fancy/), and as [ppa:aos for Debian/Ubuntu Linux](https://github.com/aos/dsf-debian). Issues relating to packaging ('installation does not work', 'version is out of date', etc.) should be directed to those packages' own repositories/issue trackers where applicable. +Issues relating to packaging ("installation does not work", "version is out of date", etc.) should be directed to those packages' repositories/issue trackers where applicable. **Note:** Windows users may need to install [MinGW](https://sourceforge.net/projects/mingw/files/) or the [Windows subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10). From 39cd6a1e68acdce4247c56ff8fd1345d0e970b68 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Mon, 15 Apr 2024 08:48:57 -0700 Subject: [PATCH 13/24] Simple wording fixes in the README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0bc89d0..4dc3140 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Vanilla `git diff` vs `git` and `diff-so-fancy` ## Install -Installation is as simple as cloning this repo and then putting the `diff-so-fancy` script in to your `$PATH`. The `lib/` directory will need to be kept relative to the core script. +Simply copy the `diff-so-fancy` script from the latest release into your `$PATH` and you're done. Alternately to test development features you can clone this repo and then put the `diff-so-fancy` script (symlink will work) into your `$PATH`. The `lib/` directory will need to be kept relative to the core script. If you are using a ZSH framework like [zgenom](https://github.com/jandamm/zgenom) or [oh-my-zsh](https://ohmyz.sh), refer to [Zsh plugin support for diff-so-fancy](pro-tips.md) for detailed installation instructions. @@ -109,7 +109,7 @@ git config --bool --global diff-so-fancy.useUnicodeRuler false By default, the separator for the file header spans the full width of the terminal. Use this setting to set the width of the file header manually. ```shell -git config --global diff-so-fancy.rulerWidth 47 # git log's commit header width +git config --global diff-so-fancy.rulerWidth 80 ``` ## The diff-so-fancy team From 0965029082fd56fbcc8219351eee3ccf9fd6c9d1 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Mon, 19 Aug 2024 18:16:12 -0700 Subject: [PATCH 14/24] Add a --rulerWidth option --- diff-so-fancy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/diff-so-fancy b/diff-so-fancy index 879aadb..9159aa1 100755 --- a/diff-so-fancy +++ b/diff-so-fancy @@ -47,6 +47,10 @@ my $columns_to_remove = 0; my $is_mercurial = 0; my $color_forced = 0; # Has the color been forced on/off +if ($args->{rulerWidth}) { + $ruler_width = int($args->{rulerWidth}); +} + # We try and be smart about whether we need to do line coloring, but # this is an option to force it on/off if ($args->{color_on}) { From 4958a1e992a2daa5cac4e65c9d4ba73459a2106a Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Wed, 18 Sep 2024 10:10:44 -0700 Subject: [PATCH 15/24] Make variable name clearer --- diff-so-fancy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diff-so-fancy b/diff-so-fancy index 9159aa1..d952098 100755 --- a/diff-so-fancy +++ b/diff-so-fancy @@ -110,13 +110,13 @@ my @lines; local $DiffHighlight::line_cb = sub { push(@lines,@_); - my $last_line = $lines[-1]; + my $prev_line = $lines[-1]; # Buffer X lines before we try and output anything # Also make sure we're sending enough data to d-s-f to do it's magic. # Certain things require a look-ahead line or two to function so # we make sure we don't break on those sections prematurely - if (@lines > 24 && ($last_line !~ /^${ansi_color_regex}(---|index|old mode|similarity index|rename (from|to))/)) { + if (@lines > 24 && ($prev_line !~ /^${ansi_color_regex}(---|index|old mode|similarity index|rename (from|to))/)) { do_dsf_stuff(\@lines); @lines = (); } From 36dcfde9dd82cd3b96abd4e82ecf8bee796381ff Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Wed, 18 Sep 2024 13:56:15 -0700 Subject: [PATCH 16/24] Add some tests for #469 --- test/bugs.bats | 6 ++++++ test/fixtures/ansi_reset_no_number.diff | 9 +++++++++ 2 files changed, 15 insertions(+) create mode 100644 test/fixtures/ansi_reset_no_number.diff diff --git a/test/bugs.bats b/test/bugs.bats index c209be7..233542e 100644 --- a/test/bugs.bats +++ b/test/bugs.bats @@ -75,3 +75,9 @@ teardown_file() { run printf "%s" "$output" assert_line --index 3 --partial "@ height" } + +@test "ANSI Reset without the zero (#469)" { + output=$( load_fixture "ansi_reset_no_number" | $diff_so_fancy ) + run printf "%s" "$output" + assert_line --index 5 --partial "History" +} diff --git a/test/fixtures/ansi_reset_no_number.diff b/test/fixtures/ansi_reset_no_number.diff new file mode 100644 index 0000000..7f51ab8 --- /dev/null +++ b/test/fixtures/ansi_reset_no_number.diff @@ -0,0 +1,9 @@ +diff --git a/history.md b/history.md +index f6776e0..a6b4546 100644 +--- a/history.md ++++ b/history.md +@@ -1,3 +1,3 @@ +-## History ++## Historyz +  + `diff-so-fancy` started as [a commit in paulirish's dotfiles](https://github.com/paulirish/dotfiles/commit/6743b907ff586c28cd36e08d1e1c634e2968893e#commitcomment-13349456), which grew into a [standalone script](https://github.com/paulirish/dotfiles/blob/63cb8193b0e66cf80ab6332477f1f52c7fbb9311/bin/diff-so-fancy). Later, [@stevemao](https://github.com/stevemao) brought it into its [own repo](https://github.com/so-fancy/diff-so-fancy) (here), and gave it the room to mature. It's quickly grown into a [widely collaborative project](https://github.com/so-fancy/diff-so-fancy/graphs/contributors). From 694f4e40a5a535b970dcff193ec1114e27528f1e Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Tue, 4 Feb 2025 21:56:11 -0800 Subject: [PATCH 17/24] Make executable --- third_party/term-colors/term-colors.pl | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 third_party/term-colors/term-colors.pl diff --git a/third_party/term-colors/term-colors.pl b/third_party/term-colors/term-colors.pl old mode 100644 new mode 100755 From 31895dc09a857858f7114e0001e9984f6c2a56e9 Mon Sep 17 00:00:00 2001 From: Linus Eriksson Date: Tue, 6 May 2025 21:47:34 +0300 Subject: [PATCH 18/24] Remove duplicate line in README (#505) --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 4dc3140..89b9ad3 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ If you are using a ZSH framework like [zgenom](https://github.com/jandamm/zgenom `diff-so-fancy` is also available from the [NPM registry](https://www.npmjs.com/package/diff-so-fancy), [brew](https://formulae.brew.sh/formula/diff-so-fancy), as a package on [Nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/version-management/diff-so-fancy/default.nix), [Fedora](https://packages.fedoraproject.org/pkgs/diff-so-fancy/diff-so-fancy/), in the [Arch extra repo](https://archlinux.org/packages/extra/any/diff-so-fancy/), and as [ppa:aos for Debian/Ubuntu Linux](https://github.com/aos/dsf-debian). -Issues relating to packaging ('installation does not work', 'version is out of date', etc.) should be directed to those packages' own repositories/issue trackers where applicable. Issues relating to packaging ("installation does not work", "version is out of date", etc.) should be directed to those packages' repositories/issue trackers where applicable. **Note:** Windows users may need to install [MinGW](https://sourceforge.net/projects/mingw/files/) or the [Windows subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10). From 1e4df2921cdb31c242176e126aa407cbb86df4d2 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Tue, 15 Jul 2025 10:58:48 -0700 Subject: [PATCH 19/24] Prettify the README with some emojis --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 89b9ad3..7892560 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ -# diff-so-fancy [![Circle CI build](https://circleci.com/gh/so-fancy/diff-so-fancy.svg?style=shield)](https://circleci.com/gh/so-fancy/diff-so-fancy) [![TravisCI build](https://travis-ci.org/so-fancy/diff-so-fancy.svg?branch=master)](https://travis-ci.org/so-fancy/diff-so-fancy) [![AppVeyor build](https://ci.appveyor.com/api/projects/status/github/so-fancy/diff-so-fancy?branch=master&svg=true)](https://ci.appveyor.com/project/stevemao/diff-so-fancy/branch/master) +# 🕶️ diff-so-fancy [![Circle CI build](https://circleci.com/gh/so-fancy/diff-so-fancy.svg?style=shield)](https://circleci.com/gh/so-fancy/diff-so-fancy) [![TravisCI build](https://travis-ci.org/so-fancy/diff-so-fancy.svg?branch=master)](https://travis-ci.org/so-fancy/diff-so-fancy) [![AppVeyor build](https://ci.appveyor.com/api/projects/status/github/so-fancy/diff-so-fancy?branch=master&svg=true)](https://ci.appveyor.com/project/stevemao/diff-so-fancy/branch/master) `diff-so-fancy` strives to make your diffs **human** readable instead of machine readable. This helps improve code quality and helps you spot defects faster. -## Screenshot +## 🖼️ Screenshot Vanilla `git diff` vs `git` and `diff-so-fancy` ![diff-highlight vs diff-so-fancy](diff-so-fancy.png) -## Install +## 📦 Install Simply copy the `diff-so-fancy` script from the latest release into your `$PATH` and you're done. Alternately to test development features you can clone this repo and then put the `diff-so-fancy` script (symlink will work) into your `$PATH`. The `lib/` directory will need to be kept relative to the core script. @@ -20,7 +20,7 @@ Issues relating to packaging ("installation does not work", "version is out of d **Note:** Windows users may need to install [MinGW](https://sourceforge.net/projects/mingw/files/) or the [Windows subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10). -## Usage +## ✨ Usage ### With git @@ -69,7 +69,7 @@ diff -r -u folder_a folder_b | diff-so-fancy ```shell diff --recursive -u folder_a folder_b | diff-so-fancy ``` -## Options +## ⚒️ Options ### markEmptyLines @@ -111,7 +111,7 @@ By default, the separator for the file header spans the full width of the termin git config --global diff-so-fancy.rulerWidth 80 ``` -## The diff-so-fancy team +## 👨 The diff-so-fancy team | Person | Role | | --------------------- | ---------------- | @@ -121,7 +121,7 @@ git config --global diff-so-fancy.rulerWidth 80 | @AOS | Debian packager | | @Stevemao/@Paul Irish | NPM release team | -## Contributing +## 🧬 Contributing Pull requests are quite welcome, and should target the [`next` branch](https://github.com/so-fancy/diff-so-fancy/tree/next). We are also looking for any feedback or ideas on how to make `diff-so-fancy` even *fancier*. @@ -132,11 +132,11 @@ Pull requests are quite welcome, and should target the [`next` branch](https://g * [Hacking and Testing](hacking-and-testing.md) * [History](history.md) -## Alternatives +## 🔃 Alternatives * [Delta](https://github.com/dandavison/delta) * [Lazygit](https://github.com/jesseduffield/lazygit) with diff-so-fancy [integration](https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md#diff-so-fancy) -## License +## 🏛️ License MIT From 4f8c95356102609685afaefb960eab8d825fb06b Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Tue, 15 Jul 2025 11:01:21 -0700 Subject: [PATCH 20/24] NIX no longer packages DSF --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7892560..90e8098 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Simply copy the `diff-so-fancy` script from the latest release into your `$PATH` If you are using a ZSH framework like [zgenom](https://github.com/jandamm/zgenom) or [oh-my-zsh](https://ohmyz.sh), refer to [Zsh plugin support for diff-so-fancy](pro-tips.md) for detailed installation instructions. -`diff-so-fancy` is also available from the [NPM registry](https://www.npmjs.com/package/diff-so-fancy), [brew](https://formulae.brew.sh/formula/diff-so-fancy), as a package on [Nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/version-management/diff-so-fancy/default.nix), [Fedora](https://packages.fedoraproject.org/pkgs/diff-so-fancy/diff-so-fancy/), in the [Arch extra repo](https://archlinux.org/packages/extra/any/diff-so-fancy/), and as [ppa:aos for Debian/Ubuntu Linux](https://github.com/aos/dsf-debian). +`diff-so-fancy` is also available from the [NPM registry](https://www.npmjs.com/package/diff-so-fancy), [brew](https://formulae.brew.sh/formula/diff-so-fancy), [Fedora](https://packages.fedoraproject.org/pkgs/diff-so-fancy/diff-so-fancy/), in the [Arch extra repo](https://archlinux.org/packages/extra/any/diff-so-fancy/), and as [ppa:aos for Debian/Ubuntu Linux](https://github.com/aos/dsf-debian). Issues relating to packaging ("installation does not work", "version is out of date", etc.) should be directed to those packages' repositories/issue trackers where applicable. From 78de3c40ba0a6172b9b4c6256992bc07543b27ec Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Tue, 15 Jul 2025 11:06:18 -0700 Subject: [PATCH 21/24] Simplify README --- README.md | 27 +-------------------------- pro-tips.md | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 90e8098..b5587b5 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,10 @@ Vanilla `git diff` vs `git` and `diff-so-fancy` Simply copy the `diff-so-fancy` script from the latest release into your `$PATH` and you're done. Alternately to test development features you can clone this repo and then put the `diff-so-fancy` script (symlink will work) into your `$PATH`. The `lib/` directory will need to be kept relative to the core script. -If you are using a ZSH framework like [zgenom](https://github.com/jandamm/zgenom) or [oh-my-zsh](https://ohmyz.sh), refer to [Zsh plugin support for diff-so-fancy](pro-tips.md) for detailed installation instructions. - `diff-so-fancy` is also available from the [NPM registry](https://www.npmjs.com/package/diff-so-fancy), [brew](https://formulae.brew.sh/formula/diff-so-fancy), [Fedora](https://packages.fedoraproject.org/pkgs/diff-so-fancy/diff-so-fancy/), in the [Arch extra repo](https://archlinux.org/packages/extra/any/diff-so-fancy/), and as [ppa:aos for Debian/Ubuntu Linux](https://github.com/aos/dsf-debian). Issues relating to packaging ("installation does not work", "version is out of date", etc.) should be directed to those packages' repositories/issue trackers where applicable. -**Note:** Windows users may need to install [MinGW](https://sourceforge.net/projects/mingw/files/) or the [Windows subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10). - ## ✨ Usage ### With git @@ -31,28 +27,7 @@ git config --global core.pager "diff-so-fancy | less --tabs=4 -RF" git config --global interactive.diffFilter "diff-so-fancy --patch" ``` -### Improved colors for the highlighted bits - -The default Git colors are not optimal. The colors used for the screenshot above were: - -```shell -git config --global color.ui true - -git config --global color.diff-highlight.oldNormal "red bold" -git config --global color.diff-highlight.oldHighlight "red bold 52" -git config --global color.diff-highlight.newNormal "green bold" -git config --global color.diff-highlight.newHighlight "green bold 22" - -git config --global color.diff.meta "11" -git config --global color.diff.frag "magenta bold" -git config --global color.diff.func "146 bold" -git config --global color.diff.commit "yellow bold" -git config --global color.diff.old "red bold" -git config --global color.diff.new "green bold" -git config --global color.diff.whitespace "red reverse" -``` - -### With diff +### Manually with diff Use `-u` with `diff` for unified output, and pipe the output to `diff-so-fancy`: diff --git a/pro-tips.md b/pro-tips.md index 41eb524..ddae8e8 100644 --- a/pro-tips.md +++ b/pro-tips.md @@ -35,6 +35,27 @@ application, it may be helpful to configure an alias: which can then be used as `git patch > changes.patch`. +## Improved colors for the highlighted bits + +The default Git colors are not optimal. The colors used for the screenshot were: + +```shell +git config --global color.ui true + +git config --global color.diff-highlight.oldNormal "red bold" +git config --global color.diff-highlight.oldHighlight "red bold 52" +git config --global color.diff-highlight.newNormal "green bold" +git config --global color.diff-highlight.newHighlight "green bold 22" + +git config --global color.diff.meta "11" +git config --global color.diff.frag "magenta bold" +git config --global color.diff.func "146 bold" +git config --global color.diff.commit "yellow bold" +git config --global color.diff.old "red bold" +git config --global color.diff.new "green bold" +git config --global color.diff.whitespace "red reverse" +``` + #### Moving around in the diff You can pre-seed your `less` pager with a search pattern so that you can move From 20afccc97df0e7a9f4028b8b3ae7ff9d3818015c Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Tue, 15 Jul 2025 11:08:31 -0700 Subject: [PATCH 22/24] We're not using TravisCI anymore --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b5587b5..1e2f16b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 🕶️ diff-so-fancy [![Circle CI build](https://circleci.com/gh/so-fancy/diff-so-fancy.svg?style=shield)](https://circleci.com/gh/so-fancy/diff-so-fancy) [![TravisCI build](https://travis-ci.org/so-fancy/diff-so-fancy.svg?branch=master)](https://travis-ci.org/so-fancy/diff-so-fancy) [![AppVeyor build](https://ci.appveyor.com/api/projects/status/github/so-fancy/diff-so-fancy?branch=master&svg=true)](https://ci.appveyor.com/project/stevemao/diff-so-fancy/branch/master) +# 🕶️ diff-so-fancy [![Circle CI build](https://circleci.com/gh/so-fancy/diff-so-fancy.svg?style=shield)](https://circleci.com/gh/so-fancy/diff-so-fancy) [[![AppVeyor build](https://ci.appveyor.com/api/projects/status/github/so-fancy/diff-so-fancy?branch=master&svg=true)](https://ci.appveyor.com/project/stevemao/diff-so-fancy/branch/master) `diff-so-fancy` strives to make your diffs **human** readable instead of machine readable. This helps improve code quality and helps you spot defects faster. From dfbde72cfd61bef941ab5ff84c748273ed953e96 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Tue, 15 Jul 2025 11:09:03 -0700 Subject: [PATCH 23/24] Use a hat to match the org --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1e2f16b..86b2ca9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 🕶️ diff-so-fancy [![Circle CI build](https://circleci.com/gh/so-fancy/diff-so-fancy.svg?style=shield)](https://circleci.com/gh/so-fancy/diff-so-fancy) [[![AppVeyor build](https://ci.appveyor.com/api/projects/status/github/so-fancy/diff-so-fancy?branch=master&svg=true)](https://ci.appveyor.com/project/stevemao/diff-so-fancy/branch/master) +# 🎩 diff-so-fancy [![Circle CI build](https://circleci.com/gh/so-fancy/diff-so-fancy.svg?style=shield)](https://circleci.com/gh/so-fancy/diff-so-fancy) [[![AppVeyor build](https://ci.appveyor.com/api/projects/status/github/so-fancy/diff-so-fancy?branch=master&svg=true)](https://ci.appveyor.com/project/stevemao/diff-so-fancy/branch/master) `diff-so-fancy` strives to make your diffs **human** readable instead of machine readable. This helps improve code quality and helps you spot defects faster. From bb015e071529846c964d821ff4a170c56a18f1fa Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Tue, 15 Jul 2025 11:09:47 -0700 Subject: [PATCH 24/24] One too many `[` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 86b2ca9..50f9d9d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 🎩 diff-so-fancy [![Circle CI build](https://circleci.com/gh/so-fancy/diff-so-fancy.svg?style=shield)](https://circleci.com/gh/so-fancy/diff-so-fancy) [[![AppVeyor build](https://ci.appveyor.com/api/projects/status/github/so-fancy/diff-so-fancy?branch=master&svg=true)](https://ci.appveyor.com/project/stevemao/diff-so-fancy/branch/master) +# 🎩 diff-so-fancy [![Circle CI build](https://circleci.com/gh/so-fancy/diff-so-fancy.svg?style=shield)](https://circleci.com/gh/so-fancy/diff-so-fancy) [![AppVeyor build](https://ci.appveyor.com/api/projects/status/github/so-fancy/diff-so-fancy?branch=master&svg=true)](https://ci.appveyor.com/project/stevemao/diff-so-fancy/branch/master) `diff-so-fancy` strives to make your diffs **human** readable instead of machine readable. This helps improve code quality and helps you spot defects faster.