From: Jeff King <peff@peff.net>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: "Filip Jorissen" <filip.jorissen@kuleuven.be>,
"Torsten Bögershausen" <tboegi@web.de>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Cloned repository has file changes -> bug?
Date: Tue, 6 Feb 2018 09:14:23 -0500 [thread overview]
Message-ID: <20180206141423.GA28721@sigill.intra.peff.net> (raw)
In-Reply-To: <87lgg6l08m.fsf@evledraar.gmail.com>
On Tue, Feb 06, 2018 at 02:24:25PM +0100, Ævar Arnfjörð Bjarmason wrote:
> 3) Such hooks slow down pushes, especially on big repos, you can
> optimize things a bit (e.g. only look in the same directories), but
> pathologically you end up needing to compare the cross-product of
> changed files v.s. all existing files for each changed file.
I think you could just complain about any tree that contains entries
that have duplicate entries after normalization. I.e.:
git rev-list --objects $new --not $old |
awk '{print $1}' |
git cat-file --batch-check='%(objecttype) %(objectname)' |
awk '/^tree/ {print $2}'|
while read tree; do
dups=$(git ls-tree $tree | cut -f 2- | tr A-Z a-z | sort | uniq -d)
test -z "$dups" || echo "$tree has duplicates: $dups"
done
That gives reasonable algorithmic complexity, but of course the shell
implementation is horrific. One could imagine that this could be
implemented as part of fsck_tree(), though, which is already reading
through all the entries (unfortunately it requires auxiliary storage
linear with the size of a given tree object, but that's not too bad).
But it would probably need:
1. To be enabled as an optional fsck warning, possibly even defaulting
to "ignore".
2. That "tr" could be any arbitrary transformation. Case-folding is
the obvious one, but in theory you could match the normalization
behavior of certain popular filesystems.
I'm not entirely convinced it's worth all of this effort, but I think it
would be _possible_ at least.
-Peff
next prev parent reply other threads:[~2018-02-06 14:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-27 19:35 Cloned repository has file changes -> bug? Filip Jorissen
2018-01-27 19:59 ` Ævar Arnfjörð Bjarmason
2018-01-28 7:57 ` Torsten Bögershausen
2018-02-06 13:09 ` Filip Jorissen
2018-02-06 13:19 ` Duy Nguyen
2018-02-06 13:24 ` Ævar Arnfjörð Bjarmason
2018-02-06 14:14 ` Jeff King [this message]
2018-02-06 14:30 ` Filip Jorissen
2018-02-06 14:36 ` Junio C Hamano
2018-01-28 15:28 ` brian m. carlson
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180206141423.GA28721@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=avarab@gmail.com \
--cc=filip.jorissen@kuleuven.be \
--cc=git@vger.kernel.org \
--cc=tboegi@web.de \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox