- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 934
commit.diff with parent vs NULL_TREE not coherent #732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for making it so easy to follow along! A great issue! Thus I believe some order is wrong when using the special 'NULL_TREE', which is what I would fix. |
@Byron indeed, this is not a bug. To get the correct DIFF, one has always to do: so NULL_TREE -> CURRENT. The correct solution is:
and the output is:
|
Computing the diff in git.stage_all failed on an empty repository because the changes were always diffed against the 'master' branch. However an empty repository doesn't have a master branch. This commit implements diffing the changes against the Git empty tree, which is represented as the sha1 hash of the C string "tree 0" (including the null byte terminator). This change allows Commodore to correctly diff changes against an empty git repository. See also: * gitpython-developers/GitPython#732 (comment) * https://stackoverflow.com/q/9765453
After adding a new file I made a diff vs NULL_TREE, I have the expected behaviour change_type == 'A'.
When making the diff of the same commit vs the parent I get change_type == 'D', I think the sha keys are not correctly passed.
Perhaps I'm wrong and I missed something... If you confirm the issue, I can fix it!
Here is an example to reproduce the issue:
test.py
test.sh
Here is the result
The text was updated successfully, but these errors were encountered: