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

Re: Cloned repository has file changes -> bug?

From
FJFilip Jorissen <filip.jorissen@kuleuven.be>
Date
Feb 6, 2018, 14:30 UTC
Message-ID
<5C27A062-A03B-4A4B-978E-40CFD78FC1AB@kuleuven.be>
In-Reply-To
<20180206141423.GA28721@sigill.intra.peff.net>
I’m not git expert but, from a user point of view, the following would make sense. When adding a file, git could check whether a different file is already in the repository with the same name (case-insensitive check). Then simply report that this may be a mistake and request to use ‘git add -f’ to force the ‘add’. Perhaps this coincides with what was suggested in earlier replies. From my point of view the check should be enabled by default, but it could be optional too. 
Filip
Show 40 quoted lines
> Op 6 feb. 2018, om 15:14 heeft Jeff King <peff@peff.net> het volgende geschreven:
> 
> 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
Previous: Jeff KingNext: Junio C Hamano
Message 8 of 10 in “Cloned repository has file changes -> bug?”
  1. Filip JorissenJan 27, 2018
  2. Ævar Arnfjörð BjarmasonJan 27, 2018
  3. Torsten BögershausenJan 28, 2018
  4. Filip JorissenFeb 6, 2018
  5. Duy NguyenFeb 6, 2018
  6. Ævar Arnfjörð BjarmasonFeb 6, 2018
  7. Jeff KingFeb 6, 2018
  8. Filip JorissenFeb 6, 2018
  9. Junio C HamanoFeb 6, 2018
  10. brian m. carlsonJan 28, 2018

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.