I think I found a bug in the diff('diff-against') function regarding reversing ordering...#40
Closed
tomrittervg wants to merge 1 commit into
Closed
I think I found a bug in the diff('diff-against') function regarding reversing ordering...#40tomrittervg wants to merge 1 commit into
tomrittervg wants to merge 1 commit into
Conversation
…ases Now do this: $ python >>> import git as pygit >>> c = pygit.Repo('github.com-tomrittervg-Code-Audit-Feed-Test-Cases.git/') >>> x = c.commit('4aee3ae658c1320619432817d63ec7adabf0f43a') >>> p = [i for i in x.diff('HEAD~1')][0] That is this commit: tomrittervg/Code-Audit-Feed-Test-Cases@4aee3ae This is the addition of a single file. Unless I'm misunderstanding git, as well as this documentation: http://packages.python.org/GitPython/0.3.1/tutorial.html#obtaining-diff-information tdiff = hcommit.diff('HEAD~1') # diff tree against previous tree x.diff('HEAD~1') ought to give a 'new_file' commit But it was reversing the commit. It ran this: git diff 4aee3ae658c1320619432817d63ec7adabf0f43a HEAD~1 --abbrev=40 --full-index --raw producing :100644 000000 5f9b998a3e2916af6671a0f8d296ad7c1fe1490d 0000000000000000000000000000000000000000 D api-call-test.c When it should be running this: git diff HEAD~1 4aee3ae658c1320619432817d63ec7adabf0f43a --abbrev=40 --full-index --raw producing this: :000000 100644 0000000000000000000000000000000000000000 5f9b998a3e2916af6671a0f8d296ad7c1fe1490d A api-call-test.c I changed the order of arguments to get it to give a file addition. This would also affect which diff the a_blob and b_blob in a 'M' and how a 'R' behaves... I think.
Member
|
Hi, Thanks for the patch. Thank you |
Contributor
|
Please do not revert the diff order I think that the current behavior is the expected one: Reversing this, would only break any existing code that depends on this. Also, So, I think this pull request could be closed. |
Member
|
I agree, reversing the order now would possibly break too much code. We can restart the discussion if needs be though. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull this repo: https://github.com/tomrittervg/Code-Audit-Feed-Test-Cases
Now do this:
$ python
That is this commit: tomrittervg/Code-Audit-Feed-Test-Cases@4aee3ae
This is the addition of a single file.
Unless I'm misunderstanding git, as well as this documentation: http://packages.python.org/GitPython/0.3.1/tutorial.html#obtaining-diff-information
tdiff = hcommit.diff('HEAD~1') # diff tree against previous tree
x.diff('HEAD~1') ought to give a 'new_file' commit
But it was reversing the commit.
It ran this:
git diff 4aee3ae658c1320619432817d63ec7adabf0f43a HEAD~1 --abbrev=40 --full-index --raw
producing
:100644 000000 5f9b998a3e2916af6671a0f8d296ad7c1fe1490d 0000000000000000000000000000000000000000 D api-call-test.c
When it should be running this:
git diff HEAD~1 4aee3ae658c1320619432817d63ec7adabf0f43a --abbrev=40 --full-index --raw
producing this:
:000000 100644 0000000000000000000000000000000000000000 5f9b998a3e2916af6671a0f8d296ad7c1fe1490d A api-call-test.c
I changed the order of arguments to get it to give a file addition. This would also affect which diff the a_blob and b_blob in a 'M' and how a 'R' behaves... I think.