Commit Graph

1975 Commits

Author SHA1 Message Date
nickelc
6a37445efb
Add methods for getting GitConfig as reference (#1336) 2023-03-09 05:15:04 -05:00
nickelc
b614b1cb1d
Get git's minus/plus style from config instead of copying it around (#1329) 2023-03-08 10:52:11 -05:00
sitiom
56fa5dd6d3
Add Winget Releaser workflow (#1331)
* Add Winget installation in the docs

* Add GitHub actions to Dependabot

* Add Winget Releaser workflow
2023-03-07 19:29:46 +00:00
Paolo Insogna
3a09926e45
Added config option. (#1324)
* feat: Added config option.
2023-03-05 17:32:11 -05:00
nickelc
5e4faabfd3
Return the GitRemoteRepo type directly (#1328)
The type is unnecessarily wrapped and it's the only use for
`GitConfigEntry::GitRemote` enum variant.
2023-03-05 17:24:24 -05:00
nickelc
a8446c53bb
Update dependencies & switch back to the dirs crate (#1325)
* Update direct dependencies

* Update transient dependencies

* Switch back to `dirs` crate

The `dirs`/`dirs-sys` repositories are unarchived and the crates are
maintained again, while `dirs-next` crates aren't.
2023-03-05 15:07:25 -05:00
nickelc
a30aa5f88f
Encapsulate git2 types (#1326)
* Move theme iteration logic to `GitConfig`

The `git2::Config` type is now encapsulated and the regex is given to
`libgit2` to filter the config entries.

* Move remote url getter to `GitConfig`
2023-03-05 14:59:30 -05:00
nickelc
420b1acea1
Update clap to 4.1 (#1322)
* Update to clap 4

* Add help, usage, error-context features to clap

* Add wrap_help clap feature

* Remove DeriveDisplayOrder as it is now default

* Update ValueSource using statement

* Update #[clap(...)] to #[command(...)]

* Update #[clap(...)] to #[arg(...)]

* Update #[structopt(...)] to #[arg(...)]

* Remove value_parser because it is now default

* Return option & argument names as `String` due to lifetime issues

* Remove leading hyphens from arguments long definition

Leading hyphens are no longer accepted.

* Argument names are derived from field names and `snake_case`

* `help` & `version` are no longer added automatically

* Update `clap` to 4.1.8

---------

Co-authored-by: tjquillan <tjquillan@gmail.com>
2023-03-03 06:19:07 -05:00
Josh Soref
590d5fa2eb
Spelling (#1257)
Corrects misspellings identified by https://github.com/marketplace/actions/check-spelling

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-03-03 05:31:28 -05:00
Max Fang
a240cc6b89
Add gruvmax-fang theme (#1291) 2023-03-03 05:29:28 -05:00
nickelc
fd76fc175f
Fix warning from bat for an unknown syntax theme (#1319) 2023-03-03 05:27:07 -05:00
nickelc
2cd66b58a7
Update git2 to 0.16.1 (#1323) 2023-03-03 05:26:18 -05:00
USAMI Kenta
29c71eb6f6
Fixed broken link to README (#1185)
Removed "configuration" chapter in 6f0bcbd504.
2023-03-03 05:18:46 -05:00
nickelc
afd36daf7e
Fix the--show-themes command (#1320)
The command failed because the two empty arguments for the internal `Opt`
parsing actually meant "<binary> <minus_file>" and since `minus_file` is now
parsed with `PathBufValueParser` and the value parser rejects empty values.
2023-03-01 16:13:46 -05:00
nickelc
f4be222c44
Reduce allocations during --show-colors (#1315)
The colors are already sorted and can be returned as they are defined.
2023-02-28 06:49:28 -05:00
nickelc
17ad30e514
Replace unmaintained/outdated GitHub Actions (#1317)
* Replace unmaintained/outdated GitHub Actions

* Replace `actions-rs/cargo` for `cross` usage
2023-02-28 06:47:49 -05:00
nickelc
28bf556897
Fix clippy warnings (#1298)
* Fix clippy warnings

- `clippy::uninlined_format_args`

* Fix clippy warnings

- `clippy::clone_on_copy`
- `clippy::explicit_auto_deref`
- `clippy::iter_cloned_collect`
- `clippy::map_clone`
- `clippy::needless_borrow`
- `clippy::needless_lifetimes`
- `clippy::needless_return`
- `clippy::redundant_clone`
- `clippy::redundant_field_names`
- `clippy::seek_to_start_instead_of_rewind`
- `clippy::unnecessary_cast`
- `clippy::unused_unit`
2023-02-28 06:37:20 -05:00
Dan Davison
ce6448f9c3 Mention use of DELTA_FEATURES in side-by-side section of manual
Fixes #1280
2023-01-13 09:04:04 -05:00
Thomas Quillan
5cef387299
Address deprecated clap features (#1251)
* Address deprecated clap features

* Move to Arg::get_id from Arg::get_name

* Move to ArgMatches::value_source

* Run rustfmt
2022-12-04 13:49:21 -05:00
Dan Davison
62513efc1b Bump version 2022-12-03 15:20:12 -05:00
Dan Davison
956b2f4115
Explicitly request xz compression (#1249)
* Explicitly request xz compression

Fixes #1248

* Do not insert a space between single-letter option and option value
2022-12-03 15:17:47 -05:00
Dan Davison
b4ae4c47fb Bump version in private Homebrew formula 2022-12-03 09:33:41 -08:00
Dan Davison
373c8b131c Bump version in links to executables 2022-12-03 09:32:28 -08:00
Dan Davison
df11d18e82 Bump version in Cargo.lock 2022-12-03 07:05:33 -08:00
Dan Davison
eaa2c55d94 Bump version 2022-12-03 07:01:05 -08:00
Sheldon Nico
54e1ee79c7
try fix bad alignment in unicode (#1144) (#1145)
* try fix bad alignment in unicode (#1144)

* use width instead of count in wrap_line

* fix fmt

* 3 tests do not need fail

* fix tests

Co-authored-by: Thomas Otto <th1000s@posteo.net>
2022-12-03 06:59:06 -08:00
Marco Ieni
667d44c885
ci: release apple arm binary (#1239)
* ci: improve formatting

* ci.yaml: apply new formatting

* ci: release apple arm binary

* use cross for mac arm

* wip

* do not use cross

* install targets
2022-12-03 06:45:26 -08:00
Phillip Wood
96c2fa8673
Highlighting improvements (#1244)
* Stop ignoring a passing test

edits::tests::test_infer_edits_12 passes so there is no need to ignore
it.

* Refactor Levenshtein tests

Reduce the amount of repetition and specify the Levenshtein distance
explicitly in preparation for changing the Levenshtein calculation and
adding more tests in a future commit. As there are quite a few inputs to
each test use a struct rather than a plain function for the tests as
this effectively provides named parameters for the inputs.

* Highlight deletions before insertions

When a token has moved within a line try to highlight it as a deletion
followed by an insertion. Currently

    -'b '
    +' b'

is highlighted as

    -'b[ ]'
    +'[ ]b'

as if the space has moved to the left, instead highlight it as

    -'[b] '
    +' [b]'

as if the "b" has moved to the right. As the changes to the tests show
this also tends to favor a longer match at the start of the line.

* Don't highlight an unchanged trailing space

Only unchanged space between changed tokens should be highlighted, if
the line ends with an unchanged space then the space should not be
highlighted.

* Try to group highlighted changes together

Sometimes the highlighting of a change is not as clear as it could
be. For example the change

    -printf "%s\n" s y y ...
    +test_write_lines s y n ...

is highlighted as

    -[printf "%]s[\n"] [s ]y y ...
    +[test_write_lines ]s y y ...

rather than

    -[printf "%s\n"] s y n ...
    +[test_write_lines] s y y ...

This is because the Levenshtein distance calculation only checks if
the current tokens match without considering if the previous tokens
matched or not. Adding a small penalty for starting a run of changed
tokens forces the changes to be grouped together whenever possible. A
knock on effect of adding the penalty is that the cost a substitution
needs to be increased relative to the cost of an insertion/deletion
otherwise the lowest cost for "ab" -> "ba" is two substitutions rather
than an insertion, match and deletion.

There are several changes to the tests

 - the Levenshtein distance is updated to reflect the new calculation in
   tests::align::*

 - several new tests are added to tests::align to check the grouping of
   different combinations of insertions and deletions

 - tests::edits::test_infer_edits_10 shows an improvement in the
   highlighting as the unchanged space at the end of the changed tokens
   is no longer highlighted. This is because it is no longer considered
   to be deleted by the Levenshtein matching as deleting the space
   between the deleted words now has a lower cost.

 - there is a new test in tests::edits using the example in this
   message.

* Stop using substitutions in Levenshtein calculation

Now that the lowest cost edit path groups deletions and insertions
together there seems to be little point in keeping substitutions. Indeed
the lower cost of substitutions compared to a deletion followed by an
insertion can adversely affect the highlighting. If the length of the
line does not change delta will prefer to use substitutions over
deletions and insertions even if it results in unchanged tokens being
marked as changed. For example in

    -[a] a a a a a [b b b]
    +[c] a a a a a [a c c]

unchanged tokens are marked as deleted and inserted. Without
substitutions this is highlighted as

    -a a a a a a [b b b]
    +[c ]a a a a a a [c c]

which highlights the insertion at the beginning of the line and the
change at the end of the line more clearly.

There is a change to the distance calculation as substitutions only
contributed the length of the deletion whereas now the same change will
add the length of both the deletion and the insertion. This is addressed
by doubling the contribution of unchanged sections so that the
denominator equals the sum of the distance contributions of the plus
line and minus line.
2022-11-29 11:00:01 -05:00
Marco Ieni
d6db040421
ci: improve formatting (#1238)
* ci: improve formatting

* ci.yaml: apply new formatting
2022-11-27 12:40:07 -05:00
Thomas Otto
afa7a1a38d Handle quoted filenames in diff header
Otherwise the file extension would return 'rs"' which does not
match any language.
2022-11-15 07:40:49 -05:00
Witold Baryluk
b5ed58da71
Remove Provides in Debian package (#1217)
Remove Provides in Debian package as this is incorrect usage of this flag.

To provide two versions of packages `Conflicts` as used is sufficient.

See Debian Policy Manual (v4.6.1.1) section 7.5

When at it Remove trailing dot in Description header to comply with section 5.6.13
Fixes: https://github.com/dandavison/delta/issues/1210
2022-11-15 07:35:15 -05:00
clnoll
6b2d0b7fc8
Fix clippy warnings (#1236) 2022-11-13 18:54:39 -05:00
Adam Johnson
5ce2efbc6b
Remove Git 2.37 workaround from install docs (#1228) 2022-11-05 06:21:22 -04:00
Thomas Otto
970000f368 measure_text_width() without constructing a temporary string 2022-10-24 17:46:13 -04:00
Thomas Otto
60492f318f Add terminal width fallback via stty if on Windows/MSYS2
Also new workarounds.rs file, and DELTA_NO_WORKAROUNDS env var
to disable these.
2022-10-11 16:19:25 -04:00
Thomas Otto
65044c0e0d Fix clippy warnings after rust 1.64 upgrade 2022-10-11 16:19:25 -04:00
Chinmay Dalal
ae4f774936
Add codeberg link parsing (#1194) 2022-10-06 13:38:30 -04:00
Dan Davison
a7bab81665 Clarify that rg --json | delta is the only fully correct grep handler
Closes #1197
2022-09-29 12:50:16 -04:00
Maxim Zhiburt
1193d54d5c
Refactoring ansi/iterator (#1191)
Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
2022-09-15 00:54:35 -04:00
Dan Davison
4e05ee5ef4 Check that new version number is present in docs
Ref #1192
2022-09-14 17:15:42 -04:00
Dan Davison
d9d80436ba Bump version in links to executables
Fixes #1192
2022-09-14 16:37:07 -04:00
Chinmay Dalal
d16ed23e73
Add sourcehut link parsing (#1190)
* Add sourcehut link parsing

* refactor: GitRemoteRepo::GitHubRepo -> ..::GitHub, repo_slug -> slug

https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names

* readme.md: change bitbucket to sourcehut
2022-09-14 15:39:23 -04:00
Marcin Puc
cc0f1dd968
Switch bat to library mode (#1187) 2022-09-13 11:53:47 -04:00
Dan Davison
06cbbf7cc4 Edit CONTRIBUTING.md 2022-09-06 19:39:47 -04:00
Dan Davison
ab39c1dc0f Add note about git config env vars to configuration manual page. 2022-09-05 10:52:04 -04:00
Dan Davison
2984a8b9d3
Change Rust toolchain in 'Deploy Manual' CI task (#1183) 2022-09-05 10:28:53 -04:00
Dan Davison
052b8bdcbf New manual content: environment variables and configuration.
Ref #1113
2022-09-05 10:05:07 -04:00
Dan Davison
5c570f4931 Bump private homebrew formula 2022-08-31 21:50:15 -04:00
Dan Davison
5d961f4e79 Whitespace formatting 2022-08-31 21:45:42 -04:00
Dan Davison
2004c4e363 Bump version in links to executables 2022-08-31 21:32:40 -04:00