Commit Graph

1975 Commits

Author SHA1 Message Date
Dan Davison
1f5ffdc306 Split README.md into mdbook manual
github actions config copied from https://github.com/Wilfred/difftastic
2022-01-15 19:27:24 -05:00
Rafael Sadowski
df00e4ad19 Add OpenBSD installation note 2022-01-15 19:10:53 -05:00
Dan Davison
c4a455f64e README edits regarding syntax-highlighting themes 2022-01-15 11:33:04 -05:00
Thomas Otto
e9bec95a57 Handle blame author names containing parentheses 2022-01-13 19:53:28 -05:00
Thomas Otto
c323fa529b Fix new 1.58 clippy lints 2022-01-13 19:53:28 -05:00
Dan Davison
056c186459 Crop images so that out-of-date command is not visible 2022-01-13 19:41:46 -05:00
Dan Davison
0b6c882150 Add diff-stat-align-width to show-config 2022-01-10 10:41:38 -05:00
Dan Davison
95eb0a0e58 New option file-transformation to transform file paths 2022-01-06 12:20:17 -05:00
Dan Davison
808ca48eef Clippy: remove redundant borrows 2022-01-05 18:55:02 -05:00
Wayne Davison
c76a26bd2d
Handle a mode change on a renamed file. (#875)
* Handle a mode change on a renamed file.

I changed the diff parsing to cache the mode info from the old/new mode
lines until the parsing bumps into the start of the actual related diff,
finds the diff line for an unrelated diff, or runs out of input.  This
allows the mode info to be output in conjunction with a file event
instead of as a separate heading (that used to have an empty name when
the mode change was for a rename).

The mode info is passed down into the draw routines as a separate
"addendum" string that the draw code can use as it likes. Currently that
means that it appends the addendum string to the non-raw string in
parens. I imagine that future draw routines could decide to put it in a
separate box or some other per-routine method. There is currently a
single function in src/handlers/draw.rs that joins the strings in the
same way for everyone.

A couple examples of how the new code looks:

Δ foo.rs (mode +x)
───────────────────────────────────────────────────

renamed: old-longer-name → shorter-name (mode +x)
───────────────────────────────────────────────────

Would it look better on its own line?

Δ foo.rs
• mode +x
───────────────────────────────────────────────────

renamed: old-longer-name → shorter-name
• mode +x
───────────────────────────────────────────────────

Would it look better appended after a "•" character?

Δ foo.rs • mode +x
───────────────────────────────────────────────────

renamed: old-longer-name → shorter-name • mode +x
───────────────────────────────────────────────────

Should it be a user option? If so, we can do that later.
2022-01-05 16:54:18 -05:00
Dan Davison
040ad76741
Fix grep parse bugs (#865)
Evolve grep output parsing heuristics

* Demand a non-space before extension

* New grep parse heuristic

If something like any of the following are seen then that is assumed
to be a file name with an extension followed by a line number. I.e. we
do not support file names with such patterns internally.

.xx-7-
.xx=7=
.xx:7:
2022-01-05 16:51:00 -05:00
Thomas Otto
48fec2e6fd Make Config cloneable for DeltaTest, store as Cow<Config> there
Only cloneable when testing, the types git2::Config and
git2::Repository in GitConfig contain C pointers and can't
really be cloned.
2022-01-04 19:51:23 -05:00
Wayne Davison
1d6f18a663
DeltaTest improvements (#876)
* DeltaTest improvements

- Added .expect_contains(), .expect_raw_contains(), and
  .expect_contains_once() member functions to DeltaTestOutput.
  These functions also output some helpful debug info when the
  assert fails.
- Separated .with_config_and_input() into .with_config() and (the
  tweaked) .with_input().
- Made .with_config() create a DeltaTest object (like .with() does).
- Renamed .with() as .with_args().
- Moved .explain_ansi() from DeltaTestOutput to DeltaTest, which must
  now be called prior to .with_input() since the latter stashes off both
  the raw_output & the processed output in the object.
- Changed .expect() and .expect_skip() to return Self so that they can
  continue a chain of multiple expect calls (e.g. a series of partial
  matches with different skip values).
- The processed output text can be accessed via `test_obj.output` (see
  also `test_obj.raw_output`).
- Renamed .expect_skip() to .expect_after_skip().
- Changed .expect() to start at the first line.
- Added .expect_after_header() that works like the old .expect().
- Renamed lines_match() to assert_lines_match() and made it match all
  lines (no skip number).
- Added assert_lines_match_after_skip() to work like the old
  lines_match() function, but with the .expect_after_skip() arg order.
- Converted some old-style tests into DeltaTest style tests.
- Renamed set_cfg as set_config
2022-01-04 03:39:03 -05:00
Dan Davison
cd47b21176 Decrease size of Amazon delta image 2022-01-03 20:16:29 -05:00
Thomas Otto
59604a376f Cache parent process when testing unless FakeParentArgs are used 2022-01-03 17:28:27 -05:00
Thomas Otto
c1392d6e1c The calling process must have a common parent with delta
Ensures that no unrelated process is found when selectively
refreshing a pid range.
2022-01-03 17:28:27 -05:00
Thomas Otto
3a3f597704 Move parent process query into a thread
Start the query even before determining if information about the
parent process is required (which are most invocations anyhow).
2022-01-03 17:28:27 -05:00
Thomas Otto
15d7bb8cf0 Re-enable full process scans on Linux 2022-01-03 17:28:27 -05:00
Thomas Otto
8f2a8ce496 Disable /proc fd caching on Linux when querying processes
This query only happens once, so caching is not needed

Also update sysinfo version to fix a crash related to this.
2022-01-03 17:28:27 -05:00
Wayne Davison
50ece4b0cc Put file-modified label in front of mode changes.
When using `--navigate` with files that get their mode modified, the
file-modified label was not being prefixed, so these changes were not
being marked as skip destinations.  This is particularly bad if a file
has line changes along with the mode change AND the user has an empty
hunk label (since that would make the entire file's changes get skipped
with an "n").

I added a test of a mode-change with a line-change, and a test for a
mode change where the old & new mode values are not one of the two
expected value-pairs.  I also used format_file() on the mode filenames
since the other format() calls were using it.
2022-01-01 08:29:25 +00:00
Dan Davison
13f60da9ff Use formatted blame metadata as blame key
Fixes #868
2021-12-28 12:16:43 +00:00
Dan Davison
62ca45953f blame-separator and blame-separator-style options 2021-12-28 12:16:43 +00:00
Dan Davison
76905c8e87 Refactor blame handler
- Give up on repeat blame line optimization
- Don't assume blame key is commit
2021-12-28 12:16:43 +00:00
Dan Davison
97747ddb43 Remove space from blame-format 2021-12-24 07:40:45 -05:00
Dan Davison
a1b8dbc410 New option blame-code-style
Fixes #867
2021-12-24 07:40:45 -05:00
Dan Davison
67124941d5 Tweak issue template 2021-12-22 12:23:09 -05:00
Dan Davison
31481db596 Tweak issue template 2021-12-22 12:04:21 -05:00
dependabot[bot]
990dca2675
Bump sysinfo from 0.22.2 to 0.22.3 (#862)
Bumps [sysinfo](https://github.com/GuillaumeGomez/sysinfo) from 0.22.2 to 0.22.3.
- [Release notes](https://github.com/GuillaumeGomez/sysinfo/releases)
- [Changelog](https://github.com/GuillaumeGomez/sysinfo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/GuillaumeGomez/sysinfo/commits)

---
updated-dependencies:
- dependency-name: sysinfo
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-20 18:13:33 -05:00
庄天翼
d71da62d49
Remove redundent spaces in README example (#861) 2021-12-19 23:26:17 -05:00
Dan Davison
ab54c116ec Update --help text 2021-12-15 19:03:29 -05:00
Dan Davison
0bf10022ad Bump version in docs 2021-12-15 18:56:15 -05:00
Dan Davison
1458879231 Bump version 2021-12-15 18:49:51 -05:00
Dan Davison
b8c93f3f07 Update sysinfo to released version
Ref #839
2021-12-15 18:44:30 -05:00
Dan Davison
b5d7c23e07
Line state refactor (#851)
* Refactor: compute raw line and new line state
2021-12-14 22:21:07 -05:00
Dan Davison
d72ddfc6ad Delete calls printing output in tests 2021-12-14 01:39:48 -05:00
Dan Davison
2dad3e8060 Add inspect_raw method to DeltaTest 2021-12-14 01:39:48 -05:00
Dan Davison
f650f485ed Add markers surrounding DeltaTest::inspect() output 2021-12-14 01:39:48 -05:00
Dan Davison
799ad15d15 Don't take syntax-theme from env var during tests
Fixes #842
2021-12-14 01:39:39 -05:00
Dan Davison
cec8542e5f Revert "Ignore test maing ANSI assertions"
This reverts commit 424fe8b59a.
2021-12-14 01:39:39 -05:00
Dan Davison
8b408cc57f Clean up DeltaTest argument 2021-12-13 23:21:31 -05:00
Dan Davison
bc8676dd4d Add Test for #753 3ce64ddefb 2021-12-13 23:21:31 -05:00
Dan Davison
cf270eefd9 Bug fix: emit merge conflict markers even when width=variable 2021-12-13 17:45:35 -05:00
Dan Davison
3ce64ddefb Emit line as raw if canonical line state is raw
Fixes #753
2021-12-12 23:34:34 -05:00
Dan Davison
1767b3be29 Refactor: make state available when determining whether line should be emitted raw 2021-12-12 23:34:34 -05:00
Dan Davison
fbf88e4686 DELTA_FEATURES appends iff prefixed with +
Thanks @bew for the suggestion.

Fixes #848
2021-12-12 17:36:56 -05:00
Dan Davison
ab278a77fb Avoid using environment variables during tests 2021-12-12 17:36:56 -05:00
Dan Davison
b995bd4ea0 Add @Wilfred's difftastic to Similar Projects section of README 2021-12-12 12:51:21 -05:00
Dan Davison
f88f0a4eda Fix tests: don't access lazy_static in tests 2021-12-12 00:20:52 -05:00
Dan Davison
9d1b25ac43 Disable line numbers and side-by-side under --word-diff
We currently have no way of computing correct line numbers: it seems that we would need to identify
wholly added and removed lines from the ANSI color sequences. side-by-side is (I imagine) almost
always used with line numbers, and it doesn't make much sense for word-diff anyway.
2021-12-12 00:20:52 -05:00
Dan Davison
c1d8867f80 Raw pass-through handling of --word-diff and --color-words output
The previous implementation (5895cfa) was incorrect.

Fixes #829
2021-12-12 00:20:52 -05:00