Re: [PATCH] Use git in scripts/setlocalversion

From: Ryan Anderson
Date: Wed Jan 04 2006 - 17:42:26 EST


Rene Scharfe wrote:
> Currently scripts/setlocalversion is a Perl script that tries to figure
> out the current git commit ID of a repo without using git. It also
> imports Digest::MD5 without using it and generally is too big for the
> small task it does. :] And it always reports a git ID, even when the
> HEAD is tagged -- this is a bug.

Yes. I'm pretty sure I sent Sam a patch for that at one point ages ago,
but I've been distracted and haven't updated it recently.

I think using git-name-rev --tags as this change does is a lot simpler
than what I was trying to do.

So, Sam, if you'd prefer this version, feel free, or let me know and
I'll resend the one or two patches I have hanging around to you.

> This patch replaces it with a Bourne Shell script that uses git
> commands to do the same. I can't come up with a scenario where someone
> would use a git repo and refuse to install git core at the same time,
> so I think it's reasonable to assume git is available.
>
> The new script also reports uncommitted changes by adding -git_dirty to
> the version string. Obviously you can't see from that _what_ has been
> changed from the last commit, so it's more of a reminder that you
> forgot to commit something.

And this is a decent feature, too. I like it.

The only reservation I have about converting from Perl to Bourne shell
is that if adding support for, say, Mercurial (or maybe CVS, etc) wants
to mangle it somehow, via say MD5, that becomes a little bit more
difficult to do, or at worst, introduces an additional dependency on
something like md5sum.

So, I like it:

Signed-off-by: Ryan Anderson <ryan@xxxxxxxxxxxxxx>

Attachment: signature.asc
Description: OpenPGP digital signature