{"thread":{"id":"64555","subject":"`git diff --max-depth` results in fatal error when comparing a merge commit with its parents","startedAt":"2025-11-30T02:30:42Z","lastAt":"2025-11-30T02:30:42Z","messageCount":1,"participants":["Han Jiang"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"531456","messageId":"CANrWfmRk-S1vF+pMH-cK6gUcDK_yeDpxvLOmGMFFZsGBATSSGQ@mail.gmail.com","threadId":"64555","inReplyTo":null,"subject":"`git diff --max-depth` results in fatal error when comparing a merge commit with its parents","fromName":"Han Jiang","fromEmail":"jhcarl0814@gmail.com","sentAt":"2025-11-30T02:30:30Z","receivedAt":"2025-11-30T02:30:42Z","isPatch":false,"sender":{"key":"jhcarl0814@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5171262?v=4"},"body":"What did you do before the bug happened? (Steps to reproduce your issue)\n\ngit init './repo'\ncd './repo'\nmkdir --parents -- './1/2/3/4/5/6'\necho '1' >'./1/2/3/4/5/6/7'; git add './1/2/3/4/5/6/7'; git commit\n--message=\"$((++number))\"; git branch branch2\ngit checkout -b branch1; echo '2' >'./1/2/3/4/5/6/7'; git add\n'./1/2/3/4/5/6/7'; git commit --message=\"$((++number))\"\ngit checkout branch2; echo '3' >'./1/2/3/4/5/6/7'; git add\n'./1/2/3/4/5/6/7'; git commit --message=\"$((++number))\"\ngit checkout branch1\ngit merge --message=\"$((++number))\" branch2\necho '4' >'./1/2/3/4/5/6/7'; git add './1/2/3/4/5/6/7'; git -c\n'core.editor=:' merge --continue\ngit lg --all --patch --diff-merges=separate\n\ngit diff HEAD 'HEAD^1' 'HEAD^2'\ngit diff --max-depth=5 HEAD 'HEAD^1' 'HEAD^2' # fatal: object '...' is\nnot a blob! # $?=128\ngit diff --max-depth=6 HEAD 'HEAD^1' 'HEAD^2'\n\ngit diff HEAD 'HEAD^1' 'HEAD^2' './1'\ngit diff --max-depth=5 HEAD 'HEAD^1' 'HEAD^2' './1' # fatal: object\n'...' is not a blob! # $?=128\ngit diff --max-depth=6 HEAD 'HEAD^1' 'HEAD^2' './1'\n\ngit diff HEAD 'HEAD^1' 'HEAD^2' './1/2'\ngit diff --max-depth=4 HEAD 'HEAD^1' 'HEAD^2' './1/2' # fatal: object\n'...' is not a blob! # $?=128\ngit diff --max-depth=5 HEAD 'HEAD^1' 'HEAD^2' './1/2' # fatal: object\n'...' is not a blob! # $?=128\n\n\nWhat did you expect to happen? (Expected behavior)\n\n`git diff --max-depth=5 HEAD 'HEAD^1' 'HEAD^2'` and `git diff\n--max-depth=5 HEAD 'HEAD^1' 'HEAD^2' './1'` and `git diff\n--max-depth=4 HEAD 'HEAD^1' 'HEAD^2' './1/2'` all output nothing.\n\n`git diff --max-depth=5 HEAD 'HEAD^1' 'HEAD^2' './1/2'` outputs a combined diff.\n\n\nWhat happened instead? (Actual behavior)\n\n`git diff --max-depth=5 HEAD 'HEAD^1' 'HEAD^2'` and `git diff\n--max-depth=5 HEAD 'HEAD^1' 'HEAD^2' './1'` and `git diff\n--max-depth=4 HEAD 'HEAD^1' 'HEAD^2' './1/2'` all output \"fatal:\nobject '...' is not a blob!\", $?=128.\n\n`git diff --max-depth=5 HEAD 'HEAD^1' 'HEAD^2' './1/2'` outputs\n\"fatal: object '...' is not a blob!\", $?=128.\n\n\nWhat's different between what you expected and what actually happened?\n\nAnything else you want to add:\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.52.0.windows.1\ncpu: x86_64\nbuilt from commit: 2912d8e9b8253723974b7baf1c890273b1a1c5bd\nsizeof-long: 4\nsizeof-size_t: 8\nshell-path: D:/git-sdk-64-build-installers/usr/bin/sh\nrust: disabled\nfeature: fsmonitor--daemon\nlibcurl: 8.17.0\nOpenSSL: OpenSSL 3.5.4 30 Sep 2025\nzlib: 1.3.1\nSHA-1: SHA1_DC\nSHA-256: SHA256_BLK\ndefault-ref-format: files\ndefault-hash: sha1\nuname: Windows 10.0 26200\ncompiler info: gnuc: 15.2\nlibc info: no libc information available\n$SHELL (typically, interactive shell): C:\\Program Files\\Git\\usr\\bin\\bash.exe\n\n\n[Enabled Hooks]\nnot run from a git repository - no hooks to show\n"}]}