Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue. What did you do before the bug happened? (Steps to reproduce your issue) $ mkdir test2 $ cd test2 $ git init Initialized empty Git repository in /Users/jim/repo/test2/.git/ $ mkdir -p foo/bar $ touch foo/bar/test $ git add foo/bar/test $ git commit -m "first commit" -u [master (root-commit) c6eb1c1] first commit 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 foo/bar/test $ git mv foo/bar/test foo/bar/test2 $ git commit -m "second commit" -u [master 2bacc0c] second commit 1 file changed, 0 insertions(+), 0 deletions(-) rename foo/bar/{test => test2} (100%) $ echo "contents" > foo/bar/test2 $ git commit -m "third commit" -a [master 13a1b11] third commit 1 file changed, 1 insertion(+) $ git --no-pager log --oneline -- ':(glob)**/test2' What did you expect to happen? (Expected behavior) 13a1b11 (HEAD -> master) third commit 2bacc0c second commit c6eb1c1 first commit What happened instead? (Actual behavior) 13a1b11 (HEAD -> master) third commit BUG: tree-diff.c:596: unsupported magic 8 error: git died of signal 6 What's different between what you expected and what actually happened? git tree-diff crashed Anything else you want to add: * Also get the crashes with ':(glob)*/bar/test2' and ':(glob)foo/*/test2'. * The `git mv` does not seem to be necessary to reproduce. Please review the rest of the bug report below. You can delete any lines you don't wish to share. [System Info] git version: git version 2.40.1 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh feature: fsmonitor--daemon uname: Darwin 19.6.0 Darwin Kernel Version 19.6.0: Tue Jun 21 21:18:39 PDT 2022; root:xnu-6153.141.66~1/RELEASE_X86_64 x86_64 compiler info: clang: 12.0.0 (clang-1200.0.32.29) libc info: no libc information available $SHELL (typically, interactive shell): /bin/bash [Enabled Hooks] -- dubiousjim@xxxxxxxxx