sourcegraph / go-vcs

manipulate and inspect VCS repositories in Go
https://sourcegraph.com/sourcegraph/go-vcs
Other
79 stars 20 forks source link

vcs/gitcmd: Commits fails on pathspec with magic due to --follow parameter to git log #110

Closed dmitshur closed 5 years ago

dmitshur commented 5 years ago

Using a pathspec that includes most magic (other than "top" and "literal") is not compatible with the --follow flag, whose documentation notes that it works only for a single file:

--follow
  Continue listing the history of a file beyond renames (works
  only for a single file).

This can be verified locally by running something like this in a git repository:

$ git log --follow HEAD -- ':(glob)*'
... (some output)
fatal: BUG:tree-diff.c:592: unsupported magic 8

$ git log HEAD -- ':(glob)*'
... (ok)

The --follow flag should only be added when vcs.CommitsOptions.Path specifies a single file rather than an unsupported magic.

More details are provided in the commit message of PR #111, which fixes this issue.