[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87tumt6ct3.fsf@ungleich.ch>
Date: Sun, 23 May 2021 11:04:40 +0200
From: Nico Schottelius <nico-linuxsetlocalversion@...ottelius.org>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: linux-kbuild@...r.kernel.org,
Nico Schottelius <nico-linuxsetlocalversion@...ottelius.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Matthias Maennich <maennich@...gle.com>,
Michael Ellerman <mpe@...erman.id.au>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/5] scripts/setlocalversion: factor out 12-chars hash
construction
Hey Masahiro,
Masahiro Yamada <masahiroy@...nel.org> writes:
> - if atag="$(git describe --abbrev=12 2>/dev/null)"; then
> - echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),substr($(NF),0,13))}'
> -
> - # If we don't have a tag at all we print -g{commitish},
> - # again using exactly 12 hex chars.
> - else
> - head="$(echo $head | cut -c1-12)"
> - printf '%s%s' -g $head
> + if atag="$(git describe 2>/dev/null)"; then
> + echo "$atag" | awk -F- '{printf("-%05d", $(NF-1))}'
> fi
> +
> + # Add -g and exactly 12 hex chars.
> + printf '%s%s' -g "$(echo $head | cut -c1-12)"
> fi
>
> # Check for uncommitted changes.
That was quite fun reviewing and wrapping my head around ~20y old code.
I had a very long mail prepared looking at all the corner cases, just to
see they are actually handled before the actual change.
Nicely simplified, for all 5 of them:
Reviewed-by: Nico Schottelius <nico-linuxsetlocalversion@...ottelius.org>
--
Sustainable and modern Infrastructures by ungleich.ch
Powered by blists - more mailing lists