Hello community, here is the log from the commit of package git-delta for openSUSE:Factory checked in at 2020-10-21 14:39:44 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/git-delta (Old) and /work/SRC/openSUSE:Factory/.git-delta.new.3486 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "git-delta" Wed Oct 21 14:39:44 2020 rev:2 rq:843138 version:0.4.4 Changes: -------- --- /work/SRC/openSUSE:Factory/git-delta/git-delta.changes 2020-09-25 16:32:19.711932671 +0200 +++ /work/SRC/openSUSE:Factory/.git-delta.new.3486/git-delta.changes 2020-10-21 14:39:59.385659778 +0200 @@ -1,0 +2,29 @@ +Wed Oct 14 08:27:19 UTC 2020 - Martin Sirringhaus <[email protected]> + +- Name the installed binary `delta`, as upstream calls it, as + renaming causes various breakages (e.g. bash completions) and + inconsitencies with upstream documentation and usage. + Add Conflict with sccs, which also provides a binary called + `delta` instead. + +------------------------------------------------------------------- +Wed Oct 14 05:56:35 UTC 2020 - Martin Sirringhaus <[email protected]> + +- Update to version 0.4.4 + * This release mostly fixes bugs in git add -p behavior, adds + test coverage, and clarifies the code involved. + In addition, a new environment variable is supported: + DELTA_PAGER. If set, this takes precedence over BAT_PAGER. + See --paging in delta --help. + * bug git add -p one-to-one correspondence errors + * bug Line numbers incorrect/relative - Windows/Delta 0.4.1 + * bug [Linux] git add -p not working with side-by-side + * bug Delta crash on Windows when using as stand-alone diff tool + * Second document label is missing last character (truncated) + +------------------------------------------------------------------- +Sat Oct 10 17:58:59 UTC 2020 - John Vandenberg <[email protected]> + +- Add Conflicts with git-extras + +------------------------------------------------------------------- Old: ---- git-delta-0.4.3.tar.gz New: ---- git-delta-0.4.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ git-delta.spec ++++++ --- /var/tmp/diff_new_pack.zpby1Z/_old 2020-10-21 14:40:00.573660450 +0200 +++ /var/tmp/diff_new_pack.zpby1Z/_new 2020-10-21 14:40:00.577660452 +0200 @@ -17,7 +17,7 @@ Name: git-delta -Version: 0.4.3 +Version: 0.4.4 Release: 0 Summary: A syntax-highlighter for git and diff output License: MIT @@ -26,6 +26,7 @@ Source1: vendor.tar.xz BuildRequires: clang-devel BuildRequires: rust-packaging +Conflicts: sccs %description Delta provides language syntax-highlighting, within-line insertion/deletion detection, and restructured diff output for git on the command line. @@ -53,16 +54,14 @@ %install %cargo_install -# There is already a package "delta" so we have to rename it -mv %{buildroot}%{_bindir}/delta %{buildroot}%{_bindir}/%{name} # install bash completion -install -D -m 0644 %{_builddir}/delta-%{version}/etc/completion/completion.bash %{buildroot}%{_datadir}/bash-completion/completions/%{name} +install -D -m 0644 %{_builddir}/delta-%{version}%{_sysconfdir}/completion/completion.bash %{buildroot}%{_datadir}/bash-completion/completions/delta %files %license LICENSE %doc README.md -%{_bindir}/%{name} -%{_datadir}/bash-completion/completions/%{name} +%{_bindir}/delta +%{_datadir}/bash-completion/completions/delta %changelog ++++++ git-delta-0.4.3.tar.gz -> git-delta-0.4.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/delta-0.4.3/Cargo.lock new/delta-0.4.4/Cargo.lock --- old/delta-0.4.3/Cargo.lock 2020-09-04 16:40:30.000000000 +0200 +++ new/delta-0.4.4/Cargo.lock 2020-10-11 00:25:28.000000000 +0200 @@ -295,7 +295,7 @@ [[package]] name = "git-delta" -version = "0.4.3" +version = "0.4.4" dependencies = [ "ansi_colours 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -306,12 +306,12 @@ "console 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 3.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.4 (registry+https://github.com/rust-lang/crates.io-index)", - "git2 0.13.10 (registry+https://github.com/rust-lang/crates.io-index)", + "git2 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "shell-words 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "syntect 4.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -320,12 +320,12 @@ [[package]] name = "git2" -version = "0.13.10" +version = "0.13.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "libgit2-sys 0.12.12+1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libgit2-sys 0.12.13+1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -402,7 +402,7 @@ [[package]] name = "libgit2-sys" -version = "0.12.12+1.0.1" +version = "0.12.13+1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.54 (registry+https://github.com/rust-lang/crates.io-index)", @@ -718,17 +718,17 @@ [[package]] name = "structopt" -version = "0.3.17" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt-derive 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt-derive 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "structopt-derive" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1007,7 +1007,7 @@ "checksum flate2 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ad3c5233c9a940c8719031b423d7e6c16af66e031cb0420b0896f5245bf181d3" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -"checksum git2 0.13.10 (registry+https://github.com/rust-lang/crates.io-index)" = "86d97249f21e9542caeee9f8e1d150905cd875bf723f5ff771bdb4852eb83a24" +"checksum git2 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)" = "1e094214efbc7fdbbdee952147e493b00e99a4e52817492277e98967ae918165" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hermit-abi 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "61565ff7aaace3525556587bd2dc31d4a07071957be715e63ce7b1eccf51a8f4" "checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" @@ -1018,7 +1018,7 @@ "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb" -"checksum libgit2-sys 0.12.12+1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0100ae90655025134424939f1f60e27e879460d451dff6afedde4f8226cbebfc" +"checksum libgit2-sys 0.12.13+1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "069eea34f76ec15f2822ccf78fe0cdb8c9016764d0a12865278585a74dbdeae5" "checksum libz-sys 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "af67924b8dd885cccea261866c8ce5b74d239d272e154053ff927dae839f5ae9" "checksum line-wrap 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9" "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" @@ -1058,8 +1058,8 @@ "checksum shell-words 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6fa3938c99da4914afedd13bf3d79bcb6c277d1b2c398d23257a304d9e1b074" "checksum smallvec 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum structopt 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc388d94ffabf39b5ed5fadddc40147cb21e605f53db6f8f36a625d27489ac5" -"checksum structopt-derive 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2513111825077552a6751dfad9e11ce0fba07d7276a3943a037d7e93e64c5f" +"checksum structopt 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "a7a7159e7d0dbcab6f9c980d7971ef50f3ff5753081461eeda120d5974a4ee95" +"checksum structopt-derive 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc47de4dfba76248d1e9169ccff240eea2a4dc1e34e309b95b2393109b4b383" "checksum syn 0.15.43 (registry+https://github.com/rust-lang/crates.io-index)" = "ee06ea4b620ab59a2267c6b48be16244a3389f8bfa0986bdd15c35b890b00af3" "checksum syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "dff0acdb207ae2fe6d5976617f887eb1e35a2ba52c13c7234c790960cdad9238" "checksum syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/delta-0.4.3/Cargo.toml new/delta-0.4.4/Cargo.toml --- old/delta-0.4.3/Cargo.toml 2020-09-04 16:40:30.000000000 +0200 +++ new/delta-0.4.4/Cargo.toml 2020-10-11 00:25:28.000000000 +0200 @@ -9,7 +9,7 @@ license = "MIT" readme = "README.md" repository = "https://github.com/dandavison/delta" -version = "0.4.3" +version = "0.4.4" [[bin]] name = "delta" @@ -28,13 +28,13 @@ lazy_static = "1.4" regex = "1.3.9" shell-words = "1.0.0" -structopt = "0.3.17" +structopt = "0.3.19" unicode-segmentation = "1.6.0" unicode-width = "0.1.8" vte = "0.8.0" [dependencies.git2] -version = "0.13.10" +version = "0.13.11" default-features = false features = [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/delta-0.4.3/HomeBrewFormula/git-delta.rb new/delta-0.4.4/HomeBrewFormula/git-delta.rb --- old/delta-0.4.3/HomeBrewFormula/git-delta.rb 2020-09-04 16:40:30.000000000 +0200 +++ new/delta-0.4.4/HomeBrewFormula/git-delta.rb 2020-10-11 00:25:28.000000000 +0200 @@ -1,14 +1,14 @@ class GitDelta < Formula - version "0.4.1" + version "0.4.3" desc "A viewer for git and diff output" homepage "https://github.com/dandavison/delta" if OS.mac? url "https://github.com/dandavison/delta/releases/download/#{version}/delta-#{version}-x86_64-apple-darwin.tar.gz" - sha256 "6011d1c838e691718f70494be0959b049077aa87d6344efb7e87599d37611f52" + sha256 "c6441563648fcc74085a5b079038fca3a1c9c91b8341d8accc07d345da8fc2c6" elsif OS.linux? url "https://github.com/dandavison/delta/releases/download/#{version}/delta-#{version}-x86_64-unknown-linux-musl.tar.gz" - sha256 "ebfb8877c0892d7cf3c11d6fdbc780697ed971436d56858c40b3225dbd469751" + sha256 "d596927a95b0dc5b6e4bc40970ad14ff38bac4c23182bae5a303b6bb51f06baa" end conflicts_with "delta" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/delta-0.4.3/Makefile new/delta-0.4.4/Makefile --- old/delta-0.4.3/Makefile 2020-09-04 16:40:30.000000000 +0200 +++ new/delta-0.4.4/Makefile 2020-10-11 00:25:28.000000000 +0200 @@ -24,7 +24,7 @@ hash: @version=$$(make version) && \ - printf "$$version-tar.gz %s\n" $$(curl -sL https://github.com/dandavison/delta/archive/$$version.tar.gz | sha256sum -) && \ + printf "$$version-tar.gz %s\n" $$(curl -sL https://github.com/dandavison/delta/archive/$$version.tar.gz | sha256sum -) && \ printf "delta-$$version-x86_64-apple-darwin.tar.gz %s\n" $$(curl -sL https://github.com/dandavison/delta/releases/download/$$version/delta-$$version-x86_64-apple-darwin.tar.gz | sha256sum -) && \ printf "delta-$$version-x86_64-unknown-linux-musl.tar.gz %s\n" $$(curl -sL https://github.com/dandavison/delta/releases/download/$$version/delta-$$version-x86_64-unknown-linux-musl.tar.gz | sha256sum -) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/delta-0.4.3/README.md new/delta-0.4.4/README.md --- old/delta-0.4.3/README.md 2020-09-04 16:40:30.000000000 +0200 +++ new/delta-0.4.4/README.md 2020-10-11 00:25:28.000000000 +0200 @@ -3,7 +3,7 @@ ## A viewer for git and diff output -Code evolves, and studying diffs is a fundamental mode of work. Delta aims to make this both efficient and enjoyable: it allows you to make extensive changes to the layout and styling of diffs, as well as allowing you to stay arbitrarily close to the default git/diff output. +Code evolves, and we all spend time studying diffs. Delta aims to make this both efficient and enjoyable: it allows you to make extensive changes to the layout and styling of diffs, as well as allowing you to stay arbitrarily close to the default git/diff output. <table> <tr> @@ -239,6 +239,10 @@ <td>Windows (<a href="https://scoop.sh/">Scoop</a>)</td> <td><code>scoop install delta</code></td> </tr> + <tr> + <td>Cargo</td> + <td><code>cargo install git-delta</code></td> + </tr> </table> ## Configuration @@ -388,13 +392,21 @@ Use the `navigate` feature to activate navigation keybindings. In this mode, pressing `n` will jump forward to the next file in the diff, and `N` will jump backwards. If you are viewing multiple commits (e.g. via `git log -p`) then navigation will also visit commit boundaries. -The recommended way to use `navigate` is to activate it only when needed, for example by doing +The recommended way to use `navigate` is to activate it only when needed, for example by using the environment variable `DELTA_NAVIGATE`: + +```bash +DELTA_NAVIGATE=1 git diff +``` + +Please note that if the environment variable is set to _anything at all_ (even `"false"` or `"0"` or `""`) then that is interpreted as true. The above command sets the environment variable in the child process only, so it has no permanent effect on your shell session. But if, for whatever reason, you do have it set in your shell environment then to deactivate it you must _unset_ the environment variable (e.g. using `unset DELTA_NAVIGATE`). You cannot deactivate it by assigning a value to it. + +An alternative is to mutate your git config file from the command line: ```bash git config --global delta.navigate true ``` -The reason is the following: Delta uses `less` as its pager, and the `navigate` feature works by doing `less --pattern <regex-matching-file-and-commit-lines>`. When the git output does not contain file/commit diff lines, `less --pattern` behaves unhelpfully (see [#234](https://github.com/dandavison/delta/issues/234), [#237](https://github.com/dandavison/delta/issues/2)). +The reason that `navigate` should not be used all the time is that Delta uses `less` as its pager, and the `navigate` feature works by doing `less --pattern <regex-matching-file-and-commit-lines>`. When the git output does not contain file/commit diff lines, `less --pattern` behaves unhelpfully (see [#234](https://github.com/dandavison/delta/issues/234), [#237](https://github.com/dandavison/delta/issues/2)). ### 24 bit color (truecolor) @@ -533,7 +545,7 @@ ## Full --help output ``` -delta 0.4.1 +delta 0.4.3 A viewer for git and diff output USAGE: @@ -680,6 +692,9 @@ --file-renamed-label <file-renamed-label> Text to display in front of a renamed file path [default: renamed:] + --max-line-length <max-line-length> + Truncate lines longer than this. To prevent any truncation, set to zero. Note that syntax-highlighting very + long lines (e.g. minified .js) will be very slow if they are not truncated [default: 512] -w, --width <width> The width of underline/overline decorations. Use --width=variable to extend decorations and background colors to the end of the text only. Otherwise background colors extend to the full terminal width diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/delta-0.4.3/src/bat/output.rs new/delta-0.4.4/src/bat/output.rs --- old/delta-0.4.3/src/bat/output.rs 2020-09-04 16:40:30.000000000 +0200 +++ new/delta-0.4.4/src/bat/output.rs 2020-10-11 00:25:28.000000000 +0200 @@ -50,15 +50,18 @@ ) -> Result<Self> { let mut replace_arguments_to_less = false; - let pager_from_env = match (env::get_env_var("BAT_PAGER"), env::get_env_var("PAGER")) { - (Some(bat_pager), _) => Some(bat_pager), - (_, Some(pager)) => { - // less needs to be called with the '-R' option in order to properly interpret the - // ANSI color sequences printed by bat. If someone has set PAGER="less -F", we - // therefore need to overwrite the arguments and add '-R'. - // - // We only do this for PAGER (as it is not specific to 'bat'), not for BAT_PAGER - // or bats '--pager' command line option. + let pager_from_env = match ( + env::get_env_var("DELTA_PAGER"), + env::get_env_var("BAT_PAGER"), + env::get_env_var("PAGER"), + ) { + (Some(delta_pager), _, _) => Some(delta_pager), + (None, Some(bat_pager), _) => Some(bat_pager), + (None, None, Some(pager)) => { + // less needs to be called with the '-R' option in order to properly interpret ANSI + // color sequences. If someone has set PAGER="less -F", we therefore need to + // overwrite the arguments and add '-R'. + // We only do this for PAGER, since it is used in other contexts. replace_arguments_to_less = true; Some(pager) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/delta-0.4.3/src/cli.rs new/delta-0.4.4/src/cli.rs --- old/delta-0.4.3/src/cli.rs 2020-09-04 16:40:30.000000000 +0200 +++ new/delta-0.4.4/src/cli.rs 2020-10-11 00:25:28.000000000 +0200 @@ -477,8 +477,8 @@ pub inspect_raw_lines: String, /// Whether to use a pager when displaying output. Options are: auto, always, and never. The - /// default pager is `less`: this can be altered by setting the environment variables BAT_PAGER - /// or PAGER (BAT_PAGER has priority). + /// default pager is `less`: this can be altered by setting the environment variables + /// DELTA_PAGER, BAT_PAGER, or PAGER (and that is their order of priority). #[structopt(long = "paging", default_value = "auto")] pub paging_mode: String, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/delta-0.4.3/src/delta.rs new/delta-0.4.4/src/delta.rs --- old/delta-0.4.3/src/delta.rs 2020-09-04 16:40:30.000000000 +0200 +++ new/delta-0.4.4/src/delta.rs 2020-10-11 00:25:28.000000000 +0200 @@ -136,11 +136,9 @@ painter.paint_buffered_minus_and_plus_lines(); state = State::HunkHeader; painter.set_highlighter(); - if should_handle(&state, config) { - painter.emit()?; - handle_hunk_header_line(&mut painter, &line, &raw_line, &plus_file, config)?; - continue; - } + painter.emit()?; + handle_hunk_header_line(&mut painter, &line, &raw_line, &plus_file, config)?; + continue; } else if source == Source::DiffUnified && line.starts_with("Only in ") || line.starts_with("Submodule ") || line.starts_with("Binary files ") @@ -193,9 +191,6 @@ /// Should a handle_* function be called on this element? fn should_handle(state: &State, config: &Config) -> bool { - if *state == State::HunkHeader && config.line_numbers { - return true; - } let style = config.get_style(state); !(style.is_raw && style.decoration_style == DecorationStyle::NoDecoration) } @@ -380,24 +375,26 @@ plus_file: &str, config: &Config, ) -> std::io::Result<()> { - if config.hunk_header_style.is_omitted { - return Ok(()); - } let decoration_ansi_term_style; + let mut pad = false; let draw_fn = match config.hunk_header_style.decoration_style { DecorationStyle::Box(style) => { + pad = true; decoration_ansi_term_style = style; draw::write_boxed } DecorationStyle::BoxWithUnderline(style) => { + pad = true; decoration_ansi_term_style = style; draw::write_boxed_with_underline } DecorationStyle::BoxWithOverline(style) => { + pad = true; decoration_ansi_term_style = style; draw::write_boxed // TODO: not implemented } DecorationStyle::BoxWithUnderOverline(style) => { + pad = true; decoration_ansi_term_style = style; draw::write_boxed // TODO: not implemented } @@ -426,12 +423,14 @@ } draw_fn( painter.writer, - &format!("{} ", line), - &format!("{} ", raw_line), + &format!("{}{}", line, if pad { " " } else { "" }), + &format!("{}{}", raw_line, if pad { " " } else { "" }), &config.decorations_width, config.hunk_header_style, decoration_ansi_term_style, )?; + } else if config.hunk_header_style.is_omitted { + writeln!(painter.writer)?; } else { let line = match painter.prepare(&raw_code_fragment, false) { s if s.len() > 0 => format!("{} ", s), @@ -466,11 +465,10 @@ config.hunk_header_style, decoration_ansi_term_style, )?; - if !config.hunk_header_style.is_raw { - painter.output_buffer.clear() - }; + painter.output_buffer.clear(); } }; + // Emit a single line number, or prepare for full line-numbering if config.line_numbers { painter diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/delta-0.4.3/src/features/line_numbers.rs new/delta-0.4.4/src/features/line_numbers.rs --- old/delta-0.4.3/src/features/line_numbers.rs 2020-09-04 16:40:30.000000000 +0200 +++ new/delta-0.4.4/src/features/line_numbers.rs 2020-10-11 00:25:28.000000000 +0200 @@ -559,6 +559,21 @@ assert_eq!(strip_ansi_codes(line_2), " 2 ⋮ │-b = 2"); } + #[test] + fn test_hunk_header_style_is_omit() { + let config = make_config_from_args(&["--line-numbers", "--hunk-header-style", "omit"]); + let output = run_delta(TWO_LINE_DIFFS, &config); + let output = strip_ansi_codes(&output); + let mut lines = output.lines().skip(4); + assert_eq!(lines.next().unwrap(), " 1 ⋮ 1 │a = 1"); + assert_eq!(lines.next().unwrap(), " 2 ⋮ │b = 2"); + assert_eq!(lines.next().unwrap(), " ⋮ 2 │bb = 2"); + assert_eq!(lines.next().unwrap(), ""); + assert_eq!(lines.next().unwrap(), "499 ⋮499 │a = 3"); + assert_eq!(lines.next().unwrap(), "500 ⋮ │b = 4"); + assert_eq!(lines.next().unwrap(), " ⋮500 │bb = 4"); + } + pub const TWO_MINUS_LINES_DIFF: &str = "\ diff --git i/a.py w/a.py index 223ca50..e69de29 100644 @@ -591,6 +606,21 @@ +bb = 2 "; + const TWO_LINE_DIFFS: &str = "\ +diff --git i/a.py w/a.py +index 223ca50..367a6f6 100644 +--- i/a.py ++++ w/a.py +@@ -1,2 +1,2 @@ + a = 1 +-b = 2 ++bb = 2 +@@ -499,2 +499,2 @@ + a = 3 +-b = 4 ++bb = 4 +"; + const FIVE_DIGIT_LINE_NUMBER_DIFF: &str = "\ diff --git i/a.py w/a.py index 223ca50..367a6f6 100644 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/delta-0.4.3/src/main.rs new/delta-0.4.4/src/main.rs --- old/delta-0.4.3/src/main.rs 2020-09-04 16:40:30.000000000 +0200 +++ new/delta-0.4.4/src/main.rs 2020-10-11 00:25:28.000000000 +0200 @@ -102,19 +102,24 @@ eprintln!("Usage: delta minus_file plus_file"); process::exit(1); }; - let diff_process = process::Command::new(PathBuf::from("diff")) + let command = "diff"; + let diff_process = process::Command::new(PathBuf::from(command)) .arg("-u") .args(&[ minus_file.unwrap_or_else(die), plus_file.unwrap_or_else(die), ]) .stdout(process::Stdio::piped()) - .spawn(); + .spawn() + .unwrap_or_else(|err| { + eprintln!("Failed to execute the command '{}': {}", command, err); + process::exit(1); + }); let mut output_type = OutputType::from_mode(config.paging_mode, None, &config).unwrap(); let mut writer = output_type.handle().unwrap(); if let Err(error) = delta( - BufReader::new(diff_process.unwrap().stdout.unwrap()).byte_lines(), + BufReader::new(diff_process.stdout.unwrap()).byte_lines(), &mut writer, &config, ) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/delta-0.4.3/src/options/set.rs new/delta-0.4.4/src/options/set.rs --- old/delta-0.4.3/src/options/set.rs 2020-09-04 16:40:30.000000000 +0200 +++ new/delta-0.4.4/src/options/set.rs 2020-10-11 00:25:28.000000000 +0200 @@ -19,8 +19,8 @@ use crate::options::{self, theme}; macro_rules! set_options { - ([$( $field_ident:ident ),* ], - $opt:expr, $builtin_features:expr, $git_config:expr, $arg_matches:expr, $expected_option_name_map:expr, $check_names:expr) => { + ([$( $field_ident:ident ),* ], + $opt:expr, $builtin_features:expr, $git_config:expr, $arg_matches:expr, $expected_option_name_map:expr, $check_names:expr) => { let mut option_names = HashSet::new(); $( let kebab_case_field_name = stringify!($field_ident).replace("_", "-"); @@ -59,7 +59,7 @@ &option_names - &expected_option_names)); } } - } + } } pub fn set_options( @@ -192,6 +192,10 @@ // there (does not emit lines in 1-1 correspondence with raw git output). See #274. if opt.color_only { opt.side_by_side = false; + opt.file_style = "raw".to_string(); + opt.commit_style = "raw".to_string(); + opt.hunk_header_style = "raw".to_string(); + opt.hunk_header_decoration_style = "none".to_string(); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/delta-0.4.3/src/options/theme.rs new/delta-0.4.4/src/options/theme.rs --- old/delta-0.4.3/src/options/theme.rs 2020-09-04 16:40:30.000000000 +0200 +++ new/delta-0.4.4/src/options/theme.rs 2020-10-11 00:25:28.000000000 +0200 @@ -65,7 +65,7 @@ /// /// Basically: /// 1. The theme is specified by the `--theme` option. If this isn't supplied then it is specified -/// by the `BAT_PAGER` environment variable. +/// by the `BAT_THEME` environment variable. /// 2. Light vs dark mode is specified by the `--light` or `--dark` options. If these aren't /// supplied then it is inferred from the chosen theme. /// diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/delta-0.4.3/src/tests/test_example_diffs.rs new/delta-0.4.4/src/tests/test_example_diffs.rs --- old/delta-0.4.3/src/tests/test_example_diffs.rs 2020-09-04 16:40:30.000000000 +0200 +++ new/delta-0.4.4/src/tests/test_example_diffs.rs 2020-10-11 00:25:28.000000000 +0200 @@ -819,11 +819,15 @@ "--line-numbers", ]); let output = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, &config); - assert!(output.contains(" -@@ -71,11 +71,8 @@ impl<'a> Alignment<'a> {")); - assert!(!output.contains(" + assert!(output.contains( + " +@@ -71,11 +71,8 @@ impl<'a> Alignment<'a> {" + )); + assert!(!output.contains( + " -@@ -71,11 +71,8 @@ impl<'a> Alignment<'a> {")); +@@ -71,11 +71,8 @@ impl<'a> Alignment<'a> {" + )); ansi_test_utils::assert_line_has_no_color( &output, 9, @@ -832,6 +836,66 @@ } #[test] + fn test_color_only_output_is_in_one_to_one_correspondence_with_input() { + _do_test_output_is_in_one_to_one_correspondence_with_input(&["--color-only", "true"]); + _do_test_output_is_in_one_to_one_correspondence_with_input(&[ + "--color-only", + "true", + "--hunk-header-style", + "normal", + "--line-numbers", + ]); + _do_test_output_is_in_one_to_one_correspondence_with_input(&[ + "--color-only", + "true", + "--file-style", + "blue", + "--commit-style", + "omit", + "--hunk-header-style", + "omit", + "--hunk-header-decoration-style", + "omit", + ]); + _do_test_output_is_in_one_to_one_correspondence_with_input(&[ + "--color-only", + "true", + "--file-style", + "blue", + "--commit-style", + "red", + "--hunk-header-style", + "syntax", + "--hunk-header-decoration-style", + "box", + ]); + } + + fn _do_test_output_is_in_one_to_one_correspondence_with_input(args: &[&str]) { + let config = integration_test_utils::make_config_from_args(args); + let output = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, &config); + let output = strip_ansi_codes(&output); + + let input_lines: Vec<&str> = GIT_DIFF_SINGLE_HUNK.split('\n').collect(); + let output_lines: Vec<&str> = output.split('\n').collect(); + assert_eq!(input_lines.len(), output_lines.len()); + + // Although git patch options only checks the line counts of input and output, + // we should check if they are identical as well to avoid unexpected decoration. + for n in 0..input_lines.len() { + let input_line = input_lines[n]; + // If config.line_numbers is enabled, + // we should remove line_numbers decoration while checking. + let output_line = if config.line_numbers && n > 11 && n < input_lines.len() - 1 { + &output_lines[n][14..] + } else { + output_lines[n] + }; + assert_eq!(input_line, output_line); + } + } + + #[test] fn test_hunk_header_style_colored_input_color_is_stripped_under_normal() { let config = integration_test_utils::make_config_from_args(&[ "--hunk-header-style", ++++++ vendor.tar.xz ++++++ /work/SRC/openSUSE:Factory/git-delta/vendor.tar.xz /work/SRC/openSUSE:Factory/.git-delta.new.3486/vendor.tar.xz differ: char 27, line 1
