Say I have a distro build system in git, which builds packages in a working directory in the git checkout: ~/mydistro/builds/pulseaudio-6.0/[tarball contents] 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 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: mkdir mydistro cd mydistro git init wget <URL> tar -xf <FILE> cd pulseaudio-7.0 ./git-version-gen ./.tarball-version 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: touch foo 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) modified: foo Untracked files: (use "git add <file>..." to include in what will be committed) pulseaudio-6.0/ $ cd pulseaudio-6.0/ $ ./git-version-gen .tarball-version 6.0-dirty
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! http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=c25b06577c2cc251c541732f245117c913206916
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.