Web lists-archives.com

Re: [PATCH/RFC] Makefile: dedup list of files obtained from ls-files




Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes:

> On Sun, Apr 21, 2019 at 9:19 AM Junio C Hamano <gitster@xxxxxxxxx> wrote:
>> diff --git a/Makefile b/Makefile
>> @@ -822,12 +822,12 @@ VCSSVN_LIB = vcs-svn/lib.a
>> -LIB_H := $(shell git ls-files '*.h' ':!t/' ':!Documentation/' 2>/dev/null || \
>> +LIB_H := $(shell (git ls-files '*.h' ':!t/' ':!Documentation/' 2>/dev/null || \
>>         $(FIND) . \
>>         -name .git -prune -o \
>>         -name t -prune -o \
>>         -name Documentation -prune -o \
>> -       -name '*.h' -print)
>> +       -name '*.h' -print) | sort -u)
>
> GNU make's "sort" function also de-dups, so an alternative is:
>
>     LIB_H := $(sort $(shell ...))

That is a much better solution.  Let me use that.

Thanks.