]> git.ipfire.org Git - thirdparty/git.git/commit
GIT-VERSION-GEN: allow running without input and output files
authorPatrick Steinhardt <ps@pks.im>
Wed, 22 Jan 2025 12:05:45 +0000 (13:05 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 Jan 2025 20:37:32 +0000 (12:37 -0800)
commitf6a2efdc9b24a14f294fdbedfae3df4ce55faa9f
treecb176a772764490cfbe85c819eadbad28ad85069
parente40622a60b7473b7a5feac4a9330239863e1352d
GIT-VERSION-GEN: allow running without input and output files

The GIT-VERSION-GEN script requires an input file containing formatting
directives to be replaced as well as an output file that will get
overwritten in case the file contents have changed. When computing the
project version for Meson we don't want to have either though:

  - We only want to compute the version without anything else, but don't
    have an input file that would match that exact format. While we
    could of course introduce a new file just for that usecase, it feels
    suboptimal to add another file every time we want to have a slightly
    different format for versioned data.

  - The computed version needs to be read from stdout so that Meson can
    wire it up for the project.

Extend the script to handle both usecases by recognizing `--format=` as
alternative to providing an input path and by writing to stdout in case
no output file was given.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
GIT-VERSION-GEN