From: Ben Crocker <bcrocker@xxxxxxxxxx> This is a sample script providing a thin layer over the git command. It is meant to substitute in redhat/Makefile and Makefile.common via the GIT macro defined in Makefile. Each git subcommand currently used by Makefile and Makefile.common can be broken out into its own case. At the moment, the output of either 'git describe' or 'git merge-base' can be overridden by means of environment variables, EGIT_OVERRIDE_DESCRIBE and EGIT_OVERRIDE_MERGE_BASE respectively. Use case: self test with test values for 'git describe' and/or 'git merge-base'. Other git subcommands are simply passed through. Usage: GIT=<path to egit.sh> EGIT_OVERRIDE_DESCRIBE=v5.9-rc8 DIST=.elrdy make dist-srpm GIT=<path to egit.sh> EGIT_OVERRIDE_MERGE_BASE=<sha1> DIST=.elrdy make dist-srpm Signed-off-by: Ben Crocker <bcrocker@xxxxxxxxxx> --- redhat/self-test/egit.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 redhat/self-test/egit.sh diff --git a/redhat/self-test/egit.sh b/redhat/self-test/egit.sh new file mode 100755 index 000000000000..b998f868a314 --- /dev/null +++ b/redhat/self-test/egit.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +arg=$1 +shift +case $arg in + describe ) + if [ -n "$EGIT_OVERRIDE_DESCRIBE" ] + then + # Should be a version, e.g. v5.9-rc8 or v5.9-rc7-1449-g57b6fb86b0ac + echo "$EGIT_OVERRIDE_DESCRIBE" + else + git describe "$@" + fi + ;; + merge-base ) + if [ -n "$EGIT_OVERRIDE_MERGE_BASE" ] + then + # This should be an SHA1: + echo "$EGIT_OVERRIDE_MERGE_BASE" + else + git merge-base "$@" + fi + ;; + * ) + git "$arg" "$@" + ;; +esac -- GitLab _______________________________________________ kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx