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 24, 2019, 11:25 UTC
Message-ID
<20190424112550.GC8695@szeder.dev>
In-Reply-To
<xmqqlg0043km.fsf@gitster-ct.c.googlers.com>
On Wed, Apr 24, 2019 at 10:03:37AM +0900, Junio C Hamano wrote:
Show 16 quoted lines
> SZEDER Gábor <szeder.dev@gmail.com> writes:
> 
> > 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.
> 
> Yup, I recall a thread we recently had where we wondered why we see
> two entries reported when we ask for 'modified' and 'deleted' at the
> same time.
> 
> Perhaps not-so-low-hanging fruit miniproject would be to teach
> "ls-files" a new "--dedup" option that does two things:
> 
>  * When -m and -d are asked at the same time, ignore '-d', because
>    '-d' will give duplicates for subsets of what '-m' would show
>    anyway; and

There are other combination of options that need similar treatment, e.g. '--cached --modified', '--cached --deleted', and I vaguely remember a combination involving '--killed' as well.

On second thought, however, I'm not sure that such a '--dedup' option would be all that useful in the above cases. If the users have to adjust their 'git ls-files' invocation by specifying '--dedup' to avoid the same paths listed multiple times, then they might just as well remove the redundant options. After all, a deleted file is inherently modified, and a modified file is inherently cached...

>  * When neither -s nor -u is given, do not show the same path more
>    than once, even the ones with multiple stages.
> 
Previous: Junio C HamanoNext: Eric Sunshine
Message 9 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.