Re: [PATCH/RFC] Makefile: dedup list of files obtained from ls-files
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 24, 2019, 01:03 UTC
- Message-ID
- <xmqqlg0043km.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20190423202109.GA8695@szeder.dev>
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
* When neither -s nor -u is given, do not show the same path more than once, even the ones with multiple stages.