Hi,

for my Linux-kernel build-script I am searching for a reliable check
of getting the ***latest*** version.
This could be 'v3.x.y-stable' or 'v3.x.y-rcX'.

'git tag' seems to be fast, but not reliable.
'git log --oneline' is slow, but does the job.

For getting v3.x.y-stable this seems to work...

$ git tag | grep ^'v3.[0-9]*' | grep -v '\-rc' | sort --version-sort
v3.0
v3.1
v3.2
v3.3
v3.4
v3.5
v3.6
v3.7
v3.8
v3.9
v3.10

...but not when listing v3.x.y-rcX, too:

$ git tag | grep ^'v3.[0-9]*' | sort --version-sort | grep ^'v3.10'
v3.10
v3.10-rc1
v3.10-rc2
v3.10-rc3
v3.10-rc4
v3.10-rc5
v3.10-rc6
v3.10-rc7

I know that v3.10 > v3.10-rcX, but not 'git tag' or 'sort --version-sort' :-).

This seems from my poor sed/awk/grep skills to be the most reliable method...

$ time git log --oneline v3.0-rc1.. | grep 'Linux 3.' | awk '{ print
$3 }' | grep ^'3.[0-9]*' | head -1
3.10

real    0m10.024s
user    0m5.611s
sys     0m4.857s

...but is slow (even I take v3.0-rc1 as the 1st version-tag of
Linux-v3.x series).

Any improvements?

Thanks in advance.

Regards,
- Sedat -
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to