Skip to content

"Bad revision" error when there is no diff to be shown #59

@kkoomen

Description

@kkoomen

Hi, awesome plugin, exactly what I personally need.

Unfortunately when I run diff_commit_file or search_log_content_file when there is no diff to be shown, I get these errors:

:AdvancedGitSearch search_log_content_file

fatal: ambiguous argument '39f498e~': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

[Process exited 128]
image

:AdvancedGitSearch diff_commit_file

fatal: bad revision '39f498e~'

[Process exited 128]

Reproduce

  • Create a new folder, let's say `bufcommits
  • Run touch a.txt b.txt
  • git add a.txt b.txt && commit -m 'added a.txt and b.txt'
  • echo test > b.txt && commit -m 'added test into b.txt'
  • Open nvim via nvim a.txt
  • Run any of the commands :AdvancedGitSearch with diff_commit_file or search_log_content_file

Cause

As I mentioned before, the problem is solely because there is no contents thus no diff to be shown. Is this something you can handle to make it a little bit nicer rather than an error?

Here's what the contents look like when there is a diff:

image

And here's what it looks like without changes:

image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions