Using git with Doxygen FILE_VERSION_FILTER
I was looking more for a git command that takes a filename and prints out how many times that file has been included in a commit.
For a file, you can use one of the commands git log
in the List of all commits section for a specific file :
git log --follow --name-only --format='%H' -- afile | wc
Another option, in How to get the git commit count value? "( git rev-list HEAD --count
) applies to the entire repo, not a single file.
It was introduced in commit f69c501, git 1.7.2-rc1, Jun 2010. Combined with -- afile
it may work. Note that this option was only officially registered in commit 75d2e5a, git 2.4.7 .
Original answer, for the whole repo:
Git has a common command git-describe
.
Or:
git describe --long --all --abbrev=7
Or (if you have placed at least one tag)
git describe --long --tags --abbrev=7
source to share
git revlist --count
takes a list of paths after --
(I don't know if this is the last function or if it was always there).
Since doxygen wants one command to call with popen()
, I use a small script like this:
#!/bin/sh
echo -n "File version: "
git -C <path_to_git_directory> rev-list HEAD --count -- $1
-C
necessary if doxygen is not running in the git directory and requires the latest version of git.
source to share
This is an old question, but since I found myself looking for the same problem, here is my solution:
FILE_VERSION_FILTER = "git log --format='%H' -1"
It will actually just get the git version for each file, and that seems to be the intended use FILE_VERSION_FILTER
. If you like, you can use shorthand revisions by changing the format from '%H'
to '%h'
.
source to share