Commit Graph

11476 Commits (809ca7a04adc05d6f705c49ccfc5c58b9ab6a63e)
 

Author SHA1 Message Date
Wilfred Hughes 167217052e Update rayon 2022-12-30 10:37:48 +07:00
Wilfred Hughes 08c1a763f2 Basic changelog parsing script for releases 2022-12-28 15:25:42 +07:00
Wilfred Hughes 3c95b2ebbb Roll version 2022-12-28 15:12:58 +07:00
Wilfred Hughes 00ecf36a22 Pop delimiters immediately, rather than having ExitDelimiter* edges
@QuarticCat observed that popping delimiters is unnecessary, and saw a
speedup in PR #401. This reduces the number of nodes in typical graphs
by ~20%, reducing runtime and memory usage.

This works because there is only one thing we can do at the end of a
list: pop the delimiter. The syntax node on the other side does not
give us more options, we have at most one. Popping all the delimiters
as soon as possible is equivalent, and produces the same graph route.

This change has also slightly changed the output of
samples_files/slow_after.rs, producing a better (more minimal)
diff. This is probably luck, due to the path-dependent nature of the
route solving logic, but it's a positive sign.

A huge thanks to @QuarticCat for their contributions, this is a huge
speedup.

Co-authored-by: QuarticCat <QuarticCat@pm.me>
2022-12-28 02:00:09 +07:00
Wilfred Hughes 4bfdc7685c Log vertex count at the info level
This is less noisy and more useful than the path logging at the debug
level.
2022-12-28 01:00:10 +07:00
Wilfred Hughes 57d1f6d449 Reserve the vec inside allocate_if_new
Pushing to this vec was showing 2.5% of total compute time in profiles.
2022-12-28 00:30:25 +07:00
Wilfred Hughes 9745d06c87 Add docs for our stack implementation 2022-12-24 17:12:58 +07:00
Wilfred Hughes 3b37b9a12c Expand symlinks before computing relative path for display paths
Fixes #447
2022-12-22 22:48:27 +07:00
Wilfred Hughes d18acce856 Update changelog for 08e7b5f41 2022-12-22 09:17:19 +07:00
Wilfred Hughes a2fa9fdbf5 Update changelog for fda897b81 2022-12-22 09:14:28 +07:00
Wilfred Hughes 3766b944a8 Define a struct for DiffOptions 2022-12-22 09:11:59 +07:00
Wilfred Hughes 08e7b5f413 Use Ubuntu 20.04 for builds
ubuntu-latest now points to 22.04:
https://github.blog/changelog/2022-11-09-github-actions-ubuntu-latest-workflows-will-use-ubuntu-22-04/

This means that distros witih older glibc versions can't use the 0.39
binaries attached to the release. The next release should resolve
this (see #446).
2022-12-21 22:33:45 +07:00
Wilfred Hughes cadceb20b0 Show whole file names too with --list-languages 2022-12-19 09:33:53 +07:00
Wilfred Hughes a21327ab13 Factor out a constant for language file associations 2022-12-19 09:23:46 +07:00
Wilfred Hughes fda897b816 Don't parse rebar.lock files as Erlang
The Erlang parser doesn't support this syntax apparently:
https://github.com/WhatsApp/tree-sitter-erlang/issues/3
2022-12-19 01:00:56 +07:00
Wilfred Hughes d169c7f96c Update version in Cargo.lock 2022-12-19 01:00:48 +07:00
Wilfred Hughes 723e3dbd0e Roll version 2022-12-19 00:20:42 +07:00
Wilfred Hughes e0fcf2b84b Add a --check-only flag
Fixes #386
2022-12-18 23:55:22 +07:00
Wilfred Hughes abd5e07654 Add a has_syntactic_changes field 2022-12-18 23:21:36 +07:00
Wilfred Hughes b34cdabfdc Prefer has_changes to has_same for clarity 2022-12-18 23:17:05 +07:00
Wilfred Hughes a2f22cb17c Only set the exit code if --exit-code is set
This is important for usage with git log, which terminates on non-zero
exit codes.
2022-12-18 23:11:18 +07:00
Wilfred Hughes b7cfff3f27 Silence some clippy lints 2022-12-18 00:33:27 +07:00
Wilfred Hughes 6a46237bb0 Set the exit code when changes are found
Closes #285
2022-12-18 00:28:54 +07:00
Wilfred Hughes 7dd6bbd609 Implement Default on DisplayOptions 2022-12-17 23:49:18 +07:00
Wilfred Hughes aa067e636b Don't bother storing bytes of binary files 2022-12-17 23:44:48 +07:00
Wilfred Hughes 4b2e601de1 Store hunks in Summary 2022-12-17 23:42:20 +07:00
Wilfred Hughes 2cf27ec7cd Display paths relative to cwd
Fixes #444
2022-12-16 10:08:38 +07:00
Wilfred Hughes afc78e976d Document Erlang support and add test
Fixes #394
2022-12-15 23:30:45 +07:00
Wilfred Hughes bb2ae868d7 Add basic Erlang syntax highlighting
Improves #394
2022-12-15 23:20:37 +07:00
Wilfred Hughes 583c55964b Fix typo 2022-12-15 09:27:13 +07:00
Wilfred Hughes 75299f79fd Configure erlang delimiters 2022-12-14 23:58:15 +07:00
Wilfred Hughes e6cec41e23 Add basic Erlang support
Add tree-sitter and configure language detection. Helps with #394

Co-authored-by: Benedikt Reinartz <filmor@gmail.com>
2022-12-14 23:51:26 +07:00
Wilfred Hughes db3a1db04e Add 'vendor/tree-sitter-erlang/' from commit 'a8b8b0e16c4f5552f5e85af3dec976a5d16af8b9'
git-subtree-dir: vendor/tree-sitter-erlang
git-subtree-mainline: c5985c88b2
git-subtree-split: a8b8b0e16c
2022-12-14 23:35:23 +07:00
Wilfred Hughes c5985c88b2 Allow null bytes in UTF16 input files 2022-12-13 09:38:24 +07:00
Wilfred Hughes 7b31be8adb Improve binary file detection heuristics
Fixes #433
2022-12-08 10:29:35 +07:00
Wilfred Hughes 84a968cdbb cargo fmt 2022-12-08 10:28:24 +07:00
Wilfred Hughes 4da26f6459 Derive equality and debug on ProbableFileKind 2022-12-08 10:04:25 +07:00
Wilfred Hughes 554fb18b7c Fix interleaved output when diffing directories
Fixes #437
2022-12-08 09:58:19 +07:00
rhirano0715 436edb2ab4 Only add colour to the first hunk header
This helps skimming the results when multiple files are changed with
multiple hunks. It makes the file changing more prominent than just
going from e.g. 5/5 to 1/10.

Fixes #400

Acked-by: Wilfred Hughes <me@wilfred.me.uk>
2022-12-01 09:38:36 +07:00
Wilfred Hughes 0eb66bebfd
Merge pull request #431 from michel-slm/binstall
Add `cargo binstall` metadata
2022-11-23 14:59:16 +07:00
Michel Alexandre Salim 08041e5793
Add `cargo binstall` metadata
Right now `cargo binstall` cannot find the pre-compiled `difftastic`
assets:

```
~
❯ cargo binstall difftastic
 INFO resolve: Resolving package: 'difftastic'
 WARN resolve: The package will be installed from source (with cargo)
Do you wish to continue? yes/[no]
? no
 WARN Installation cancelled

~ took 18s
❯ cargo binstall difftastic --pkg-url="{ repo }/releases/download/{ version }/difft-{ target }.{ archive-format }"
 INFO resolve: Resolving package: 'difftastic'
 WARN resolve: The package will be downloaded from github.com
 INFO resolve: This will install the following binaries:
 INFO resolve:   - difft (difft -> /home/michel/.cargo/bin/difft-v0.38.0)
 INFO resolve: And create (or update) the following symlinks:
 INFO resolve:   - difft (/home/michel/.cargo/bin/difft -> difft-v0.38.0)
Do you wish to continue? yes/[no]
? yes
 INFO install: Installing binaries...
 INFO Done in 9.277840305s
```

Adding this `pkg-url` override to `Cargo.toml` allows `binstall` to find
the pre-compiled archives:

```
~
❯ cargo binstall --manifest-path ~/src/github/Wilfred/difftastic/Cargo.toml difftastic
 INFO resolve: Resolving package: 'difftastic'
 INFO resolve: difftastic v0.38.0 is already installed, use --force to override
 INFO Done in 5.327886ms

~
❯ cargo binstall --manifest-path ~/src/github/Wilfred/difftastic/Cargo.toml difftastic --force
 INFO resolve: Resolving package: 'difftastic'
 WARN resolve: The package will be downloaded from github.com
 INFO resolve: This will install the following binaries:
 INFO resolve:   - difft (difft -> /home/michel/.cargo/bin/difft-v0.38.0)
 INFO resolve: And create (or update) the following symlinks:
 INFO resolve:   - difft (/home/michel/.cargo/bin/difft -> difft-v0.38.0)
Do you wish to continue? yes/[no]
? yes
 INFO install: Installing binaries...
 INFO Done in 5.484314255s
```

Signed-off-by: Michel Alexandre Salim <michel@michel-slm.name>
2022-11-23 14:01:25 +07:00
Wilfred Hughes 8e190677e7 Roll version 2022-11-14 00:30:56 +07:00
Wilfred Hughes 2e7c90c472 Ensure line wrapping uses the same length on both sides
Closes #421
2022-11-13 00:35:06 +07:00
Wilfred Hughes 0603b9fb23 Include LICENSE in crates.io source files
Closes #423
2022-11-13 00:13:47 +07:00
Wilfred Hughes 923989d1a8 clippy fixes 2022-11-03 22:18:56 +07:00
Wilfred Hughes b662a2220b Apply upstream tree_magic_mini patch to fix blank line crash
Fixes #378
2022-10-31 00:54:24 +07:00
Wilfred Hughes 7f7b35441b Ensure that inline display without color has newlines
This was broken in 3147eb8e6a when
newline splitting was made consistent, and
2071517621 only fixed the inline case
when color was enabled.

Fixed #383
2022-10-28 23:42:52 +07:00
Wilfred Hughes 28c3b0ef5d Tweak line number styling to make it more distinct from content
Dim line numbers for unchanged lines, and make changed lines bold (in
addition to the existing red/green colours).

Closes #384
2022-10-28 20:34:36 +07:00
Wilfred Hughes 2a3346e338 Use apply_line_number_color consistently on LHS and RHS
Previously we missed a case on the LHS.
2022-10-28 20:18:17 +07:00
Wilfred Hughes 4d8d2a2f9d Fix a clippy lint 2022-10-28 19:39:44 +07:00