[Mesa-dev] [PATCH] automake: avoid fetching unnecessary data for the generation of git_sha1.h

Eric Engestrom eric.engestrom at imgtec.com
Wed Jun 1 17:31:38 UTC 2016


On Wed, Jun 01, 2016 at 12:18:57AM +0200, Tobias Klausmann wrote:
> Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann at mni.thm.de>
> ---
>  src/Makefile.am | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/Makefile.am b/src/Makefile.am
> index f5c0773..d0990dc 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -22,8 +22,8 @@
>  git_sha1.h:
>  	@if test -e $(top_srcdir)/.git; then \
>  		if which git > /dev/null; then \
> -		    git --git-dir=$(top_srcdir)/.git log -n 1 --oneline | \
> -			sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
> +		    git --git-dir=$(top_srcdir)/.git rev-parse --short HEAD | \
> +			sed 's/^\(.*\)/#define MESA_GIT_SHA1 "git-\1"/' \

We don't need sed when the only output is already what we want. I'd find
something like this cleaner, but your patch also works:

	printf '#define MESA_GIT_SHA1 "git-%s"\n' > git_sha1.h \
	        $(git --git-dir=$(top_srcdir)/.git rev-parse --short HEAD)

Either way, this patch is:
Tested-by: Eric Engestrom <eric.engestrom at imgtec.com>

>  			> git_sha1.h ; \
>  		fi \
>  	fi
> -- 
> 2.8.3


More information about the mesa-dev mailing list