git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Apr 23, 2019, 20:21 UTC
Message-ID
<20190423202109.GA8695@szeder.dev>
In-Reply-To
<20190422144927.GA6519@sigill.intra.peff.net>
On Mon, Apr 22, 2019 at 10:49:27AM -0400, Jeff King wrote:
Show 19 quoted lines
> 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.

I remember being rather puzzled by 'git ls-files' listing the same file more than once depending on its --options when I was working on the git-aware path completion parts of our completion script.

Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 11 in “Makefile: dedup list of files obtained from ls-files”
  1. Makefile: dedup list of files obtained from ls-filesJunio C Hamano, Apr 21, 2019
  2. Eric SunshineApr 22, 2019
  3. Junio C HamanoApr 22, 2019
  4. Jeff KingApr 22, 2019
  5. Ramsay JonesApr 22, 2019
  6. Junio C HamanoApr 23, 2019
  7. SZEDER GáborApr 23, 2019
  8. Junio C HamanoApr 24, 2019
  9. SZEDER GáborApr 24, 2019
  10. Eric SunshineApr 24, 2019
  11. Junio C HamanoApr 25, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.