From: Ramsay Jones <ramsay@ramsayjones.plus.com>
To: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH/RFC] Makefile: dedup list of files obtained from ls-files
Date: Mon, 22 Apr 2019 18:15:34 +0100 [thread overview]
Message-ID: <d869060a-a731-ff1d-3131-a146078fcf88@ramsayjones.plus.com> (raw)
In-Reply-To: <20190422144927.GA6519@sigill.intra.peff.net>
On 22/04/2019 15:49, Jeff King wrote:
> 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.
My immediate thought was "that is simply a bug, no?" :-D
I haven't used 'git ls-files' that much, so it's no great surprise
that I had not noticed it odd behaviour!
So, this evening, I decided to have a little play:
$ git status
On branch master
You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)
Changes to be committed:
new file: d
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: a
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: b
deleted: c
Untracked files:
(use "git add <file>..." to include in what will be committed)
e
$ git ls-files
a
a
a
b
c
d
$ git ls-files -c
a
a
a
b
c
d
$ git ls-files -m
a
a
a
b
c
$ git ls-files -d
c
$ git ls-files -u
100644 4ef30bbfe26431a69c3820d3a683df54d688f2ec 1 a
100644 af72a79d2a6bd4b252b0aca22dba9946f7eedf86 2 a
100644 f8829dfb9bf82721903d239ef069fb5de395f3e7 3 a
$ git ls-files -s
100644 4ef30bbfe26431a69c3820d3a683df54d688f2ec 1 a
100644 af72a79d2a6bd4b252b0aca22dba9946f7eedf86 2 a
100644 f8829dfb9bf82721903d239ef069fb5de395f3e7 3 a
100644 4f2e6529203aa6d44b5af6e3292c837ceda003f9 0 b
100644 a296d0bb611188cabb256919f36bc30117cca005 0 c
100644 72ad562535b8551cdd6659e8fb6c7cf6830e6a07 0 d
$ git ls-files -sd
100644 4ef30bbfe26431a69c3820d3a683df54d688f2ec 1 a
100644 af72a79d2a6bd4b252b0aca22dba9946f7eedf86 2 a
100644 f8829dfb9bf82721903d239ef069fb5de395f3e7 3 a
100644 4f2e6529203aa6d44b5af6e3292c837ceda003f9 0 b
100644 a296d0bb611188cabb256919f36bc30117cca005 0 c
100644 72ad562535b8551cdd6659e8fb6c7cf6830e6a07 0 d
100644 a296d0bb611188cabb256919f36bc30117cca005 0 c
$ git ls-files -su
100644 4ef30bbfe26431a69c3820d3a683df54d688f2ec 1 a
100644 af72a79d2a6bd4b252b0aca22dba9946f7eedf86 2 a
100644 f8829dfb9bf82721903d239ef069fb5de395f3e7 3 a
$ git ls-files -sm
100644 4ef30bbfe26431a69c3820d3a683df54d688f2ec 1 a
100644 af72a79d2a6bd4b252b0aca22dba9946f7eedf86 2 a
100644 f8829dfb9bf82721903d239ef069fb5de395f3e7 3 a
100644 4f2e6529203aa6d44b5af6e3292c837ceda003f9 0 b
100644 a296d0bb611188cabb256919f36bc30117cca005 0 c
100644 72ad562535b8551cdd6659e8fb6c7cf6830e6a07 0 d
100644 4ef30bbfe26431a69c3820d3a683df54d688f2ec 1 a
100644 af72a79d2a6bd4b252b0aca22dba9946f7eedf86 2 a
100644 f8829dfb9bf82721903d239ef069fb5de395f3e7 3 a
100644 4f2e6529203aa6d44b5af6e3292c837ceda003f9 0 b
100644 a296d0bb611188cabb256919f36bc30117cca005 0 c
$ git ls-files -sdu
100644 4ef30bbfe26431a69c3820d3a683df54d688f2ec 1 a
100644 af72a79d2a6bd4b252b0aca22dba9946f7eedf86 2 a
100644 f8829dfb9bf82721903d239ef069fb5de395f3e7 3 a
100644 a296d0bb611188cabb256919f36bc30117cca005 0 c
$ git ls-files -sdum
100644 4ef30bbfe26431a69c3820d3a683df54d688f2ec 1 a
100644 af72a79d2a6bd4b252b0aca22dba9946f7eedf86 2 a
100644 f8829dfb9bf82721903d239ef069fb5de395f3e7 3 a
100644 4ef30bbfe26431a69c3820d3a683df54d688f2ec 1 a
100644 af72a79d2a6bd4b252b0aca22dba9946f7eedf86 2 a
100644 f8829dfb9bf82721903d239ef069fb5de395f3e7 3 a
100644 4f2e6529203aa6d44b5af6e3292c837ceda003f9 0 b
100644 a296d0bb611188cabb256919f36bc30117cca005 0 c
100644 a296d0bb611188cabb256919f36bc30117cca005 0 c
$ git ls-files -sdumo
e
100644 4ef30bbfe26431a69c3820d3a683df54d688f2ec 1 a
100644 af72a79d2a6bd4b252b0aca22dba9946f7eedf86 2 a
100644 f8829dfb9bf82721903d239ef069fb5de395f3e7 3 a
100644 4ef30bbfe26431a69c3820d3a683df54d688f2ec 1 a
100644 af72a79d2a6bd4b252b0aca22dba9946f7eedf86 2 a
100644 f8829dfb9bf82721903d239ef069fb5de395f3e7 3 a
100644 4f2e6529203aa6d44b5af6e3292c837ceda003f9 0 b
100644 a296d0bb611188cabb256919f36bc30117cca005 0 c
100644 a296d0bb611188cabb256919f36bc30117cca005 0 c
$
Er, ... well, I obviously don't have a clue how it is supposed
to work. This just looks broken to me. :(
> So the patch itself looks good to me (though I agree that Eric's
> suggestion to de-dup inside "make" is better still).
Agreed.
ATB,
Ramsay Jones
next prev parent reply other threads:[~2019-04-22 17:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-21 13:19 [PATCH/RFC] Makefile: dedup list of files obtained from ls-files Junio C Hamano
2019-04-22 3:23 ` Eric Sunshine
2019-04-22 6:11 ` Junio C Hamano
2019-04-22 14:49 ` Jeff King
2019-04-22 17:15 ` Ramsay Jones [this message]
2019-04-23 1:18 ` Junio C Hamano
2019-04-23 20:21 ` SZEDER Gábor
2019-04-24 1:03 ` Junio C Hamano
2019-04-24 11:25 ` SZEDER Gábor
2019-04-24 17:19 ` Eric Sunshine
2019-04-25 0:59 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d869060a-a731-ff1d-3131-a146078fcf88@ramsayjones.plus.com \
--to=ramsay@ramsayjones.plus.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).