[cfe-dev] git-clang-format version

Andrey Prokopenko via cfe-dev cfe-dev at lists.llvm.org
Wed Dec 28 08:09:49 PST 2016


Hi Jonas,

Thanks for suggestions. I knew about those options, but using them still
requires extra work as instead of checking the version by doing a simple

  $ git clang-format --version

I have to first determine which clang-format binary there is (depending on
the way it is installed it may be called clang-format, clang-format-3.9,
clang-format-mp-3.9) and then call version on it. This seems like an
unnecessary busy work. Of course, once determined, I could use
clangFormat.binary to remember it.

-Andrey

On Wed, Dec 28, 2016 at 2:58 AM, Jonas Devlieghere <jonas at devlieghere.com>
wrote:

> Hi Andrey,
>
> Functionality of `git clang-format` is provided by a python script,
> which should just call the clang-format binary that is available in
> your path. In other words it should use the same version as you see
> when you do
>
> $ clang-format -version
>
> However, if for some reason you want to use a different binary, you
> can pass it explicitly with
>
> $ git clang format --binary /path/to/clang-format
>
> For all the available options, use
>
> $ git clang-format -h
>
> or have a look at the underlying script [1].
>
> Regards,
>
> Jonas
>
> [1] https://github.com/llvm-mirror/clang/blob/master/
> tools/clang-format/git-clang-format
>
>
> On Sun, Dec 25, 2016 at 7:59 AM, Andrey Prokopenko via cfe-dev
> <cfe-dev at lists.llvm.org> wrote:
> > Hi list,
> >
> > Is there a way to determine a version of clang-format from running
> > git-clang-format?
> >
> > Some background: I have a .clang_format that works for a specific
> > clang-format version. I'd also like to be able to use git-clang-format
> but I
> > would need a test to determine whether I should run it. Ideally, there
> would
> > be something like
> >
> >   $ git-clang-format --version
> >
> > which would be equivalent to
> >
> >   $ clang-format --version
> >
> > but I didn't see anything like that. My only workaround at this point is
> > start querying all different variant of clang-format executables in
> $PATH.
> >
> > Thank you.
> >
> > -Andrey
> >
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161228/9b5fa47c/attachment.html>


More information about the cfe-dev mailing list