[QUESTION] how to diff one blob with nothing
- From
ZheNing Hu <adlternative@gmail.com>
- Date
- Jul 19, 2023, 09:59 UTC
- Message-ID
- <CAOLTT8TVGna+C9nYy9nj3h5bT7AdAT0SKtUM3YVz6h=KZhGHHg@mail.gmail.com>
Hi,
I want to diff two blobs right now, and one of them may be empty, so I tried using 0000000000000000000000000000000000000000 or e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 (empty blobID) to test its effect, and the result I found was:
git diff 00750edc07d6415dcc07ae0351e9397b0222b7ba 0000000000000000000000000000000000000000 fatal: bad object 0000000000000000000000000000000000000000
git diff 00750edc07d6415dcc07ae0351e9397b0222b7ba e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 fatal: bad object e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
Since the "empty object" has not been created, the git diff operation fails.
There may be some other methods [1] available to diff two blobs by creating an empty blob, but I don't want to create this empty blob, are there any other ways to solve this problem?
[1]: https://stackoverflow.com/questions/14564034/creating-a-git-diff-from-nothing