tpope / vim-fugitive

fugitive.vim: A Git wrapper so awesome, it should be illegal
https://www.vim.org/scripts/script.php?script_id=2975
20.11k stars 1.01k forks source link

My company's "pre-commit" hook produces output I need to review, can `:G commit` output get captured? #2187

Closed nebbish closed 1 year ago

nebbish commented 1 year ago

My company just installed some pre-commit hooks that, among other things, invokes Clang-Tidy in order to validate the "style" of our C++ code.

Here is an example of the output from git commit in a terminal:

C:\source>git commit
running clang-format...
running clang-tidy...
43 warnings and 27 errors generated.

   *   *   *

<file>:<ln>:<col>: error: invalid case style for function 'translator' [readability-identifier-naming,-warnings-as-errors]
        CPolicyTranslatorImpl* translator() { return &m_translator; }
                               ^~~~~~~~~~
                               Translator

I have reviewed the already existing "pre-commit" related issues -- some related to interaction, or running background, and still popping up the editor.... all of this highlighting that this is a "complicated" flow.

So, this is not about altering that flow in any way -- just about capturing a bit of it for later review. Is that doable?

Maybe there already is a fugitive command to dump the last command's output into a new buffer. I could not find it. If that does not exist -- could that be a way to handle this request?

tpope commented 1 year ago

:Gedit -

https://github.com/tpope/vim-fugitive/blob/43f18ab9155c853a84ded560c6104e6300ad41da/doc/fugitive.txt#L626

Skallwar commented 9 months ago

Thanks for the answer, I had the same issue. Is there a way to fill the quickfix list instead?

tpope commented 9 months ago

Is there a way to fill the quickfix list instead?

You can do basically anything with the right autocommand. See https://github.com/tpope/vim-fugitive/discussions/2105#discussioncomment-4745681.