Closed matu3ba closed 2 years ago
Yes sorry, the :DiffviewFileHistory
command was changed in #151. The path args no longer default to the current file. See my reasoning for the change in the PR. Instead, use %
which expands to the current file:
:DiffviewFileHistory --range={rev} %
Would be very nice, if you could update the README: https://github.com/sindrets/diffview.nvim#diffviewfilehistory-paths-options.
What do you mean? It is already updated to reflect the new usage. Is something unclear?
DiffviewFileHistory --range=50ec55fa..HEAD %
works, but this does not conform :DiffviewFileHistory [paths] [options]
, because the option is before the path. DiffviewFileHistory % --range=50ec55fa..HEAD also works
DiffviewFileHistory --range=HEAD~5..HEAD %
still does not work, but it is valid syntax: git diff HEAD~100..HEAD file
. Take as example git diff HEAD~100..HEAD lib/std/child_process.zig
. At least for me git diff lib/std/child_process.zig HEAD~100..HEAD
also does not work.HEAD^
, because its relative useless. However, this should be documented.Last time I looked it worked.
DiffviewFileHistory --range=50ec55fa..HEAD %
works, but this does not conform:DiffviewFileHistory [paths] [options]
, because the option is before the path.
@matu3ba You can specify options and path args in any order. It's just documented as [paths] [options]
because that is easier to understand than something like [(options|paths)...]
. This is also consistent with other UNIX tools that similarly do not care about the order of args (i.e. man ls(1)
).
DiffviewFileHistory --range=HEAD~5..HEAD %
still does not work
What exactly do you mean when you say it doesn't work? This certainly does work on my end at least. Are sure there are changes for the file you are targeting between HEAD~5
and HEAD
? (Worth noting here that your configured log-options will affect what commits can be listed. If git-log does not return any diff-able commits for your configured options, the plugin will just inform you that there is no history for the targets given current options).
but it is valid syntax:
git diff HEAD~100..HEAD file
Please note that DiffviewFileHistory
is a git-log porcelain, and as such the options are passed to git-log, not directly to git-diff. This is worth noting because git-log and git-diff treats rev args (at times, very) differently. As a general rule, if git log --oneline --numstat [options] -- [paths]
does not list any commits with stats, then DiffviewFileHistory
will not be able to list any commits. Which means that especially for merge commits, it's important to note the value of --diff-merges
. As this will control how git-log treats merge commits, and its willingness to show stats for said commits.
I would propose not to support
HEAD^
I don't understand why you are proposing this. The rev args are just passed to git-log anyway, so all revs that git-log understands are supported. I see no need to explicitly prevent support for certain rev syntax.
Last time I looked it worked.
What git version are you on? After #151, the minimum required git version is 2.31.0.
Mhm. No idea what was broken, but it works now. Thanks for to detailed information. This answers all question thoroughly.
What git version are you on? After https://github.com/sindrets/diffview.nvim/pull/151, the minimum required git version is 2.31.0.
$ git --version git version 2.36.1
Instead, I get the list of all commit diffs in
diffview:///panels/DiffViewFileHistoryPanel
.