Re: [PATCH v2] scripts/setlocalversion: make git describe output more reliable

From: Nico Schottelius
Date: Mon Sep 21 2020 - 05:35:24 EST



Hey Rasmus,

Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> writes:
>> So I suggest you introduce something on the line of:
>>
>> ...
>> num_chars=12
>> ...
>> --abbrev=$num_chars
>
> I considered that, but it becomes quite ugly since it needs to get into
> the awk script (as a 13, though perhaps we could get awk to do the +1, I
> don't really speak awk), where we'd then need to use " instead of ' and
> then escape the $ that are to be interpreted by awk and not the shell.

No need for that, awk can read (and use) environment variables...

> So I think it's more readable with hardcoding and comments explaining
> why they are there; should anyone ever want to change 12.

... so that in practice you only need to change 13 to var+1 and 12 to $var.

Cheers,

Nico


--
Modern, affordable, Swiss Virtual Machines. Visit www.datacenterlight.ch