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

Tobias Klausmann tobias.johannes.klausmann at mni.thm.de
Wed Jun 1 18:04:57 UTC 2016



On 01.06.2016 19:31, Eric Engestrom wrote:
> 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)

You are right! Feel free to send a patch if you want! :)
Thanks,
Tobias

>
> 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