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

Re: icase pathspec magic support in ls-tree

From
EEErik Cervin Edin <erik@cervined.in>
Date
Oct 14, 2022, 08:03 UTC
Message-ID
<CA+JQ7M8s1W68+mzfe__+T5bJ821wYJqfgLBqA1=dSVH9Tx9fHA@mail.gmail.com>
In-Reply-To
<CABPp-BHaMCcLjdx2m4CALZQiTRQy_LovWfbdrga6XWhQJhoxWQ@mail.gmail.com>
Show 7 quoted lines
> I don't imagine I can make a perfectly correct and universal fix to
> this, but with case-insensitive matching on ls-tree in an update hook
> I believe I could reduce the frequency of this already-infrequent
> issue by at least 1000X, which would suit my purposes just fine. In my
> case filenames are mostly ansi-based, and I don't expect we've ever
> had Turkish filenames (turkish "i" being the most famous case-folding
> gotcha I think?).

How about doing it in something that's not ls-tree? Sounds like you already have a script, it just takes a bit too long?

Something similar to
On Fri, Oct 14, 2022 at 6:59 AM Torsten Bögershausen <tboegi@web.de> wrote:
>
> For example, we can use Linux:
>  git ls-files | tr 'A-Z' 'a-z' | sort | uniq -d ; echo $?

In a repo with many files, maybe use git diff --name-only and just run it periodically as a part of a check-in hook or something?

  git diff --name-only HEAD~100..HEAD | tr 'A-Z' 'a-z' | sort | uniq -d
On Fri, Oct 14, 2022 at 9:59 AM Elijah Newren <newren@gmail.com> wrote:
Show 5 quoted lines
>
> git diff --diff-filter=A --no-renames --name-only $OLDHASH $NEWHASH |
> sed -e s%/[^/]*$%/% | uniq | xargs git ls-tree --name-only $NEWHASH |
> \
>    sort | uniq -i -d
Or what Elijah just wrote
Show 12 quoted lines
> Coming at this from another angle, I guess we could teach git on
> case-insensitive filesystems to detect this situation (where two files
> in the index, with different contents, are pointing to the exact same
> filesystem file) and more explicitly warn the user of what's wrong,
> giving them clear help on how to fix it? And temporarily exclude those
> two files from its change reconciliation processes altogether to avoid
> ghost changes interfering with recovery actions like "pull"? Certainly
> that would be better than the current "ghost changes" behavior... but
> it would still be far less convenient than preventing (the vast
> majority of) these issues altogether, be that with a custom hook or a
> core option prohibiting clearly case-insensitive-duplicate files from
> being pushed.

That's not to say this isn't a good idea but for now I'd advice an automated scripted route.

Previous: Elijah NewrenNext: Tao Klerks
Message 9 of 16 in “icase pathspec magic support in ls-tree”
  1. Tao KlerksSep 30, 2022
  2. Ævar Arnfjörð BjarmasonSep 30, 2022
  3. brian m. carlsonOct 2, 2022
  4. Tao KlerksOct 13, 2022
  5. Torsten BögershausenOct 14, 2022
  6. Tao KlerksOct 14, 2022
  7. Erik Cervin EdinOct 14, 2022
  8. Elijah NewrenOct 14, 2022
  9. Erik Cervin EdinOct 14, 2022
  10. Tao KlerksOct 14, 2022
  11. Tao KlerksOct 14, 2022
  12. Tao KlerksOct 14, 2022
  13. Erik Cervin EdinOct 14, 2022
  14. Elijah NewrenOct 14, 2022
  15. Tao KlerksOct 15, 2022
  16. Tao KlerksOct 17, 2022

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.