diffview-plus.nvim icon indicating copy to clipboard operation
diffview-plus.nvim copied to clipboard

[Bug] DiffviewFileHistory -S"term" matches as a regex, so literal searches silently return wrong results

Open 3dyuval opened this issue 1 month ago • 0 comments

In git, -S"term" matches the string literally. So :DiffviewFileHistory <path> -S"term" should match it literally too. Instead diffview+ adds --pickaxe-regex, so the string is matched as a pattern.

The effect is silent. -Sfoo.bar also matches fooXbar. -Sfoo(bar) is read as a group, not as text. The results are wrong, with no hint why.

The -G flag is unaffected, because git already treats it as a pattern. See git/init.lua#L798. The -S line adds the pattern flag: git/init.lua#L799.

Expected behavior

-S<term> matches the term literally, like git log -S<term>. Pattern matching should be opt-in, not forced.

Actual behavior

-S<term> always runs as -S<term> --pickaxe-regex. The term is matched as a pattern. Metacharacters are not matched literally. There is no way to request literal behavior.

Steps to reproduce

  1. In any repo, run :DiffviewFileHistory <path> -Sfoo.bar
  2. It also matches lines containing fooXbar.
  3. Native git log -Sfoo.bar -- <path> matches only the literal foo.bar.

Health check

Output of :checkhealth diffview
==============================================================================
diffview:                                                                   ✅

Checking icon provider ~
- ✅ OK Icon provider found: nvim-web-devicons.

Checking VCS tools ~
- The plugin requires at least one of the supported VCS tools to be valid.
- ✅ OK Git is up-to-date. (2.55.0)

Log info

Relevant info from :DiffviewLog
[FileHistory] Updating with options: { flags = { "--follow", "-n256",
  "--diff-merges=first-parent", "-Smenu", "--pickaxe-regex" },
  path_args = { ".../Crossings.vue" } }

--pickaxe-regex is present even though only -Smenu was typed.

Neovim version

NVIM v0.13.0-dev-1418+gf97bcbdf77
Build type: RelWithDebInfo
LuaJIT 2.1.1787165859

diffview+ 3aba39f, git 2.55.0.

Operating system and version

Linux 6.18.52-1-cachyos-lts x86_64 GNU/Linux

3dyuval avatar Nov 02 '26 12:11 3dyuval