Say I have a distro build system in git, which builds packages in a working directory in the git checkout:
git-version-gen will read the version from .tarball-version and then try running git diff-index, at which point git will iterate up until it finds ~/mydistro/.git/ and report that the repo is dirty, resulting in a build of Pulseaudio that thinks its version 6.0-dirty. Obviously, this isn't right.
Created attachment 116439 [details] [review]
Prototype patch for review/comment.
Sorry, I don't follow.
If you have tarball contents, and you run "./git-version-gen ./.tarball-version" you'll get "6.0", not "6.0-dirty" regardless of you have a .git directory higher up in the path.
I tried to reproduce, like this:
tar -xf <FILE>
and it reported back "7.0", not "7.0-dirty".
Could you clarify?
You need pending modifications in the containing git tree (so git thinks there are changes to commit, thus being dirty). In your test case after git init something like this will replicate:
git add foo ; git commit foo
echo foo >foo
$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
(use "git add <file>..." to include in what will be committed)
$ cd pulseaudio-6.0/
$ ./git-version-gen .tarball-version
Ok, now I can reproduce it, thanks.
Your patch looks good enough to me (except that it is a "git diff" rather than "git format-patch"), but you wrote it as being a "prototype".
Is there anything that you'd like to change in it before I commit it? If so, feel free to upload a new one.
There wasn't anything I wanted to change, so feel free to commit it as-is.
Pushed now, thanks for the contribution!