On Fri, Dec 20, 2024 at 08:17:14AM -0800, Junio C Hamano wrote: > Jeff King <peff@xxxxxxxx> writes: > > > So I dunno. I like keeping things simple, but I also like skipping > > unnecessary code, too. Maybe if the top hunk were: > > > > if test -n "$GIT_VERSION" > > then > > : do nothing, we will use this value verbatim > > elif ... > > > > that would make the intended flow more obvious. > > True. > > > There are probably other ways to structure it, too. The whole $VN thing > > could be inside the: > > > > if test -z "$GIT_VERSION" > > > > block. Or alternatively, if each block of the if/else just ran expr and > > set $GIT_VERSION itself (perhaps with a one-liner helper function) then > > we wouldn't need $VN at all. > > True again. It has been quite a while since I wrote the original > before the meson topic came up and the script hasn't changed for a > long time (other than DEF_VER line for obvious reasons), but I think > in that ancient version, $VN _was_ the variable to be looked at and > GIT_VERSION did not even exist as a shell variable at all. > > If $GIT_VERSION is serving the same role as old $VN in the > mesonified version, perhaps we should get rid of the $VN variable to > clarify the new world order. I think for now I'll keep $VN, if even just to discern the intermediate value without the leading "v" stripped from the final version that we have in "$GIT_VERSION". But I'll send a revised version where I make the control flow a bit more obvious. Thanks! Patrick