Re: [PATCH/RFC] Makefile: dedup list of files obtained from ls-files
- Date: Mon, 22 Apr 2019 10:49:27 -0400
- From: Jeff King <peff@xxxxxxxx>
- Subject: Re: [PATCH/RFC] Makefile: dedup list of files obtained from ls-files
On Sun, Apr 21, 2019 at 10:19:04PM +0900, Junio C Hamano wrote:
> I am not fan of adding the "| sort -u" of the whole thing,
> because there is no need to dedup the output of the $(FIND) side
> of the alternative, but "(ls-files | sort -u) || (find)" would
> obviously not work. If we truly care, perhaps we should add a
> new option to ls-files to show each path only once, unless it is
> showing the stage number (i.e. "ls-files -s" or "ls-files -u"),
> but this gets the problem go away without code change, hence this
> RFC ;-)
FWIW, after reading your commit message my thoughts immediately turned
to "why can't ls-files have a mode that outputs each just once", but
then ended up at the same place as your patch: it's not that hard to
just de-dup the output.
It _could_ be a sign that other scripts besides our Makefile would
benefit from such an option, but I think I'd want to see at least one
other example before going in that direction.
So the patch itself looks good to me (though I agree that Eric's
suggestion to de-dup inside "make" is better still).