On Fri, Dec 27, 2024 at 3:35 AM Simon Josefsson <si...@josefsson.org> wrote:
> Hi Jim, all,

Hi Simon,

> If I run git-version-gen in a snapshot of a git repository it will
> return UNKNOWN because it cannot find out the version.
>
> Git has a .gitattribute mechanism to mark some files as 'export-subst'
> which makes git-archive substitute some strings in the file, when it is
> exporting a snapshot.
>
> Instead of giving UNKNOWN in this situation, I think it would be nice if
> git-version-gen handled this case, when the maintainer has opted in on
> this scheme.
>
> The code addition is small, after all current logic I'm adding this:
>
> if test "x$v" = xUNKNOWN \
>         && test -f ${tarball_version_file}-git \
>         && head -1 ${tarball_version_file}-git \
>             | grep -v '^$Format' > /dev/null 2>&1; then
>     v=$(head -1 ${tarball_version_file}-git)
> fi

That code uses "grep -v" where the intent must have been to use just "grep".
I've fixed that and cleaned up via this just-pushed change:

Attachment: git-version-gen-git.diff
Description: Binary data

Reply via email to